Last active
September 29, 2019 21:11
-
-
Save sfdcale/7ea47c3b68e4a108c767dce3a207d78c to your computer and use it in GitHub Desktop.
This shell script prints all EmailTemplate components present in the org.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=devcrm --json | jq '.result[].fullName' > temp.txt | |
| input="temp.txt" | |
| rm -f package_temp.xml | |
| echo "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n" >> package_temp.xml | |
| echo "<Package xmlns=\"http://soap.sforce.com/2006/04/metadata\">" >> package_temp.xml | |
| echo " <types>" >> package_temp.xml | |
| while IFS= read -r line | |
| do | |
| folderName="${line//\"/}" | |
| #folderName="'$id'" | |
| echo "$folderName" | |
| rm -f temp_1.txt | |
| sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --json | jq '.result[].fullName' >> temp_1.txt | |
| while IFS= read -r line1 | |
| do | |
| templateName="${line1//\"/}" | |
| echo " <members>$templateName</members>" >> package_temp.xml | |
| done < "temp_1.txt" | |
| done < "$input" | |
| echo " <name>EmailTemplate</name>" >> package_temp.xml | |
| echo " </types>" >> package_temp.xml | |
| echo " <version>46.0</version>" >> package_temp.xml | |
| echo "</Package>" >> package_temp.xml | |
| cat package_temp.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment