1

I have been digging for almost a week into the forums and S/F Developer pages for good "basic" Java code to retrieve a package from one ORG and Deploy to another ORG. I have had success building the ANT scripts to do this work. ANT is limited to known objects in the Deploy ORG. I want to delete all report folders and reload only the ones from my Package Retrieve ORG for example. I have to get more creative with the metadata-API via JAVA to clean up before replacing the reports. I'm looking for insights others may have to begin down this path.

Super basic ANT build.xml:

<target name="pullmaster">
  <mkdir dir="masterdata"/>
  <sf:retrieve username="${sf.usermaster}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="masterdata" packageNames="${sf.pkgName}"/>
</target> 

Basic build.xml to push up to destination ORG:

<target name="pushDemo">
  <input message="Enter The DEMO ORG you want to push to:(3,4...) "   addproperty="org"  defaultvalue="0" />
  <echo message="Demo user demo${org}@myURL.com"/>
  <sf:deploy username="demo${org}@myURL.com" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="masterdata" rollbackOnError="true"/>
</target>
  • Have you tried github.com/neowit/tooling-force.com ? It supports deployAllDestructive which (based on your source Org and package.xml) will remove stuff (not present in the source Org) from the destination Org before deploying what you have in the source. Not sure if deployAllDestructive will work for report folders, as these are tricky, but it works for normal stuff like classes/pages/objects, etc. – gaiser Jan 18 '17 at 16:53
  • @gaiser Thanks for the lead. I'll dig into this now. – Roger C Jan 18 '17 at 17:22
  • You can use destructive deployment deployments from Ant. Check the documentation - developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/…. – SL man Jan 18 '17 at 18:44
  • If you need all meta data you can put * in the package.xml <types> <members>*</members> <name>ApexClass</name> </types> – SL man Jan 18 '17 at 18:45
  • @SLman I had not had any luck using the * wildcard on report folders in the ANT script – Roger C Jan 18 '17 at 21:45

Your Answer

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

Browse other questions tagged or ask your own question.