Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. # Salesforce Org Snapshot - Ant Script
  2.  
  3. This macrodef retrieves a snapshot of ALL components in a Salesforce organization using only the Force.com Migration Tool. You can use this to download the entire metadata contents of an org to backup or commit to source control. In the interest of simplicity it uses vanilla Ant without any extra JAR dependencies.
  4.  
  5. Usage: _(copy the below XML into your build file)_
  6.  
  7. ```
  8. <target name="snapshot">
  9. <snapshot
  10. username="${sf.username}"
  11. password="${sf.password}"
  12. loginurl="${sf.serverurl}"
  13. outPath="src"
  14. />
  15. </target>
  16. ```
  17.  
  18. ### How does it work?
  19.  
  20. First step is to identify the "shape" of the org. All applicable metadata types are discovered using sf:describeMetadata. Different orgs have different features, this describe works universally.
  21.  
  22. Second step is to iterate through each metadata type and list all components using sf:listMetadata. This is used to assemble an explicit package definition / project manifest, since the `*` wildcard does not work for all component types.
  23.  
  24. Third step is to retrieve the components!
  25.  
  26. ### Why does it trace the first SOAP request?
  27.  
  28. It's faster to use an existing Session ID than log in to the Metadata API each time. By dumping the first API call to file, the script can extract a Session ID and use that for all subsequent calls. This saves 100+ round trips or handshakes.
  29.  
  30. ### Are there any components not included in the snapshot?
  31.  
  32. Missing:
  33.  
  34. - Reports
  35. - Dashboards
  36. - Documents
  37. - EmailTemplate
  38.  
  39. These components live in Folders which must be listed separately.
  40.  
  41. ### How many components can it retrieve?
  42.  
  43. Maximum of 10,000 components, the salesforce package limit. If the organization exceeds this limit, you can exclude managed packages from the retrieve, or investigate sf:bulkRetrieve which operates differently.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement