2

I would like to automate sales force package installation using python. In my day to day activity i have been spending more time in this scenario. It will be of great help if some one can throw some pointers related to this.

Thanks, Balaji.

  • It would help if you could be a little more specific with your question. – martin Dec 11 '15 at 5:38
  • I need to install managed package to salesforce org so that i can use my product for testing. Usually i will end in installing more than 3 managed package and i have all the url for the packages in an excel. Now i want to write a python script which will read the excel and install package one by one by providing access to all user while installing the package. Hope this provide some overview of my requirement: @martin – Balaji Rajendran Dec 11 '15 at 5:57
  • Have you heard of the Force.com Migration Tool? That would give you a pretty easy way to install managed packages programatically. – martin Dec 11 '15 at 6:07
  • If you haven't used Ant before, there would be some set up time / learning curve involved in using the Migration Tool. If you don't want to spend time learning the existing tool, using python to build into the Metadata API should also work for you. – martin Dec 11 '15 at 6:12
  • Great thoughts...@martin, can we install packages from appExchange using ANT? I am not so sure about the idea... – San Tosh Dec 11 '15 at 6:40
2

It is possible to install managed packages from the appExchange using the metadata api / ant. If you want to test it out, you can try deploying this to one of your orgs: (installs Quote of the Day)

./build.xml

<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>

<target name="installQuoteOfTheDay">
    <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="dirName"/>
</target>

</project>

./dirName/package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>QOTD</members>
        <name>InstalledPackage</name>
    </types>
    <version>29.0</version>
</Package>

./dirName/installedPackages/QOTD.installedPackage

<?xml version="1.0" encoding="UTF-8"?>
<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata">
<versionNumber>1.11</versionNumber>
</InstalledPackage>

Of course you could also develop a tool using python to perform the deployment through the Metadata API if you don't want to use the Ant Migration Tool.

To install your managed package, you would just have to replace QOTD (Quote of the Day's namespace) with your package's namespace.

  • great @martin :) – San Tosh Dec 11 '15 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.