How can I retrieve email templates from a sandbox using the Salesforce CLI?Can you perform DML operations from visualforce email templates?Download & Email Case Details using templatesHow to add hyperlinks to icons in email templates using letter heads?How can I hide email templates that are not available to use in the folders under “My Templates”Retrieve all metadata from an existing sandbox (for Salesforce DX conversion)How to Pass the Record Object in a Click Action From a Lighting Aura Iteration?How do I retrieve email templates from a sandbox using sfdxhow to retrieve the previous email template?Retrieving Custom Object using Visual Studio Code and Salesforce CLI

Does adamantium solve the giant mecha problem?

As its creator, can Snape reverse Sectumsempra?

find ".ts" but not ".d.ts"

How would I measure the Carbon Dioxide content in Coca Cola over a period of time?

Is it true that "Trump did not have a serious opportunity to offer his side of the story" in the House impeachment proceedings?

What is the best way to teach JavaScript functions to middle schoolers?

What does it mean to play "positionally", and how do you train that?

What game has this black main menu?

Sharepoint 2016 User Profile Service syncronization only works after iisreset

Should I sign a NDA that holds me liable for legal fees even if I am in the right?

Moving into check for a draw as black, why is it illegal? Comparison to Racing Kings

What would be the effect(s) of this asteroid?

To whom does "Madam Speaker" refer during the Trump impeachment debate?

What would happen if a Cleric blessed a Warlock with a fiend patron?

Can I use Thaumaturgy to hide the effect of Detect Magic?

How can there exist a profession consisting of investing others' money?

Does Special Relativity Imply Multiple Realities?

Using a heater and toaster oven trips the breaker. Can an electrician fix this?

What would have been the typical drinks for a US farmer in the late 18th/early 19th century?

How do airlines compute weight allowances for carry-on bags?

How to prevent email address from displaying on edit profile page?

Should I provide my username and password for my brokerage account to my mortgage lender to verify my assets?

A story both SF and Fantasy where a character in a spacesuit has a phantom arm

Change LANG variable in current shell



How can I retrieve email templates from a sandbox using the Salesforce CLI?


Can you perform DML operations from visualforce email templates?Download & Email Case Details using templatesHow to add hyperlinks to icons in email templates using letter heads?How can I hide email templates that are not available to use in the folders under “My Templates”Retrieve all metadata from an existing sandbox (for Salesforce DX conversion)How to Pass the Record Object in a Click Action From a Lighting Aura Iteration?How do I retrieve email templates from a sandbox using sfdxhow to retrieve the previous email template?Retrieving Custom Object using Visual Studio Code and Salesforce CLI






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









4


















I tried to use the force:source:retrieve command with the -m parameter as EmailTemplate but it doesn't retrieve the email templates in my connected sandbox.



How can I retrieve the email templates?










share|improve this question































    4


















    I tried to use the force:source:retrieve command with the -m parameter as EmailTemplate but it doesn't retrieve the email templates in my connected sandbox.



    How can I retrieve the email templates?










    share|improve this question



























      4













      4









      4








      I tried to use the force:source:retrieve command with the -m parameter as EmailTemplate but it doesn't retrieve the email templates in my connected sandbox.



      How can I retrieve the email templates?










      share|improve this question














      I tried to use the force:source:retrieve command with the -m parameter as EmailTemplate but it doesn't retrieve the email templates in my connected sandbox.



      How can I retrieve the email templates?







      email-template metadata salesforcedx-cli






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 2 at 20:02









      Renato OliveiraRenato Oliveira

      8,3654 gold badges25 silver badges63 bronze badges




      8,3654 gold badges25 silver badges63 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          3



















          The EmailTemplate metadata type does not support wildcard retrieval[0] - in package.xml or using the CLI. You need to specify each individual EmailTemplate you want to retrieve. E.g. sfdx force:source:retrieve -m EmailTemplate won't work, but sfdx force:source:retrieve -m EmailTemplate:folder/MyEmailTemplate should .



          [0] https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm#!






          share|improve this answer


































            3



















            I ran into this situation few days ago, so I created a bash script, which will first query all email folders and then creates package.xml and retrieves all EmailTemplates using that package.xml.



            This is assuming you are on a unix box and jq is installed.



            1) Prepare a file named DownloadAllEmailTemplates.sh with below content:



            rm -f 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

            sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=$1 --json | jq '.result[].fullName' > temp.txt
            input="temp.txt"
            echo " <types>" >> package_temp.xml
            while IFS= read -r line
            do
            folderName="$line//"/"
            echo "$folderName"
            rm -f temp_1.txt
            sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --targetusername=$1 --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"
            rm -f temp_1.txt
            done < "$input"
            echo " <name>EmailTemplate</name>" >> package_temp.xml
            echo " </types>" >> package_temp.xml
            rm -f temp.txt

            sfdx force:source:retrieve --targetusername=$1 --manifest=package_temp.xml


            If you have a org alias as production, you can run the below command to retrieve all email templates from that org.




            sh DownloadAllEmailTemplates.sh production







            share|improve this answer




























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "459"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );














              draft saved

              draft discarded
















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f280145%2fhow-can-i-retrieve-email-templates-from-a-sandbox-using-the-salesforce-cli%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown


























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3



















              The EmailTemplate metadata type does not support wildcard retrieval[0] - in package.xml or using the CLI. You need to specify each individual EmailTemplate you want to retrieve. E.g. sfdx force:source:retrieve -m EmailTemplate won't work, but sfdx force:source:retrieve -m EmailTemplate:folder/MyEmailTemplate should .



              [0] https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm#!






              share|improve this answer































                3



















                The EmailTemplate metadata type does not support wildcard retrieval[0] - in package.xml or using the CLI. You need to specify each individual EmailTemplate you want to retrieve. E.g. sfdx force:source:retrieve -m EmailTemplate won't work, but sfdx force:source:retrieve -m EmailTemplate:folder/MyEmailTemplate should .



                [0] https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm#!






                share|improve this answer





























                  3















                  3











                  3









                  The EmailTemplate metadata type does not support wildcard retrieval[0] - in package.xml or using the CLI. You need to specify each individual EmailTemplate you want to retrieve. E.g. sfdx force:source:retrieve -m EmailTemplate won't work, but sfdx force:source:retrieve -m EmailTemplate:folder/MyEmailTemplate should .



                  [0] https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm#!






                  share|improve this answer
















                  The EmailTemplate metadata type does not support wildcard retrieval[0] - in package.xml or using the CLI. You need to specify each individual EmailTemplate you want to retrieve. E.g. sfdx force:source:retrieve -m EmailTemplate won't work, but sfdx force:source:retrieve -m EmailTemplate:folder/MyEmailTemplate should .



                  [0] https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm#!







                  share|improve this answer















                  share|improve this answer




                  share|improve this answer








                  edited Oct 2 at 20:16

























                  answered Oct 2 at 20:09









                  shliachtxshliachtx

                  462 bronze badges




                  462 bronze badges


























                      3



















                      I ran into this situation few days ago, so I created a bash script, which will first query all email folders and then creates package.xml and retrieves all EmailTemplates using that package.xml.



                      This is assuming you are on a unix box and jq is installed.



                      1) Prepare a file named DownloadAllEmailTemplates.sh with below content:



                      rm -f 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

                      sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=$1 --json | jq '.result[].fullName' > temp.txt
                      input="temp.txt"
                      echo " <types>" >> package_temp.xml
                      while IFS= read -r line
                      do
                      folderName="$line//"/"
                      echo "$folderName"
                      rm -f temp_1.txt
                      sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --targetusername=$1 --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"
                      rm -f temp_1.txt
                      done < "$input"
                      echo " <name>EmailTemplate</name>" >> package_temp.xml
                      echo " </types>" >> package_temp.xml
                      rm -f temp.txt

                      sfdx force:source:retrieve --targetusername=$1 --manifest=package_temp.xml


                      If you have a org alias as production, you can run the below command to retrieve all email templates from that org.




                      sh DownloadAllEmailTemplates.sh production







                      share|improve this answer































                        3



















                        I ran into this situation few days ago, so I created a bash script, which will first query all email folders and then creates package.xml and retrieves all EmailTemplates using that package.xml.



                        This is assuming you are on a unix box and jq is installed.



                        1) Prepare a file named DownloadAllEmailTemplates.sh with below content:



                        rm -f 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

                        sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=$1 --json | jq '.result[].fullName' > temp.txt
                        input="temp.txt"
                        echo " <types>" >> package_temp.xml
                        while IFS= read -r line
                        do
                        folderName="$line//"/"
                        echo "$folderName"
                        rm -f temp_1.txt
                        sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --targetusername=$1 --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"
                        rm -f temp_1.txt
                        done < "$input"
                        echo " <name>EmailTemplate</name>" >> package_temp.xml
                        echo " </types>" >> package_temp.xml
                        rm -f temp.txt

                        sfdx force:source:retrieve --targetusername=$1 --manifest=package_temp.xml


                        If you have a org alias as production, you can run the below command to retrieve all email templates from that org.




                        sh DownloadAllEmailTemplates.sh production







                        share|improve this answer





























                          3















                          3











                          3









                          I ran into this situation few days ago, so I created a bash script, which will first query all email folders and then creates package.xml and retrieves all EmailTemplates using that package.xml.



                          This is assuming you are on a unix box and jq is installed.



                          1) Prepare a file named DownloadAllEmailTemplates.sh with below content:



                          rm -f 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

                          sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=$1 --json | jq '.result[].fullName' > temp.txt
                          input="temp.txt"
                          echo " <types>" >> package_temp.xml
                          while IFS= read -r line
                          do
                          folderName="$line//"/"
                          echo "$folderName"
                          rm -f temp_1.txt
                          sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --targetusername=$1 --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"
                          rm -f temp_1.txt
                          done < "$input"
                          echo " <name>EmailTemplate</name>" >> package_temp.xml
                          echo " </types>" >> package_temp.xml
                          rm -f temp.txt

                          sfdx force:source:retrieve --targetusername=$1 --manifest=package_temp.xml


                          If you have a org alias as production, you can run the below command to retrieve all email templates from that org.




                          sh DownloadAllEmailTemplates.sh production







                          share|improve this answer
















                          I ran into this situation few days ago, so I created a bash script, which will first query all email folders and then creates package.xml and retrieves all EmailTemplates using that package.xml.



                          This is assuming you are on a unix box and jq is installed.



                          1) Prepare a file named DownloadAllEmailTemplates.sh with below content:



                          rm -f 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

                          sfdx force:mdapi:listmetadata --metadatatype=EmailFolder --targetusername=$1 --json | jq '.result[].fullName' > temp.txt
                          input="temp.txt"
                          echo " <types>" >> package_temp.xml
                          while IFS= read -r line
                          do
                          folderName="$line//"/"
                          echo "$folderName"
                          rm -f temp_1.txt
                          sfdx force:mdapi:listmetadata --metadatatype=EmailTemplate --folder=$folderName --targetusername=$1 --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"
                          rm -f temp_1.txt
                          done < "$input"
                          echo " <name>EmailTemplate</name>" >> package_temp.xml
                          echo " </types>" >> package_temp.xml
                          rm -f temp.txt

                          sfdx force:source:retrieve --targetusername=$1 --manifest=package_temp.xml


                          If you have a org alias as production, you can run the below command to retrieve all email templates from that org.




                          sh DownloadAllEmailTemplates.sh production








                          share|improve this answer















                          share|improve this answer




                          share|improve this answer








                          edited Oct 3 at 4:23

























                          answered Oct 3 at 3:24









                          javanoobjavanoob

                          6,6306 gold badges34 silver badges85 bronze badges




                          6,6306 gold badges34 silver badges85 bronze badges































                              draft saved

                              draft discarded















































                              Thanks for contributing an answer to Salesforce Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f280145%2fhow-can-i-retrieve-email-templates-from-a-sandbox-using-the-salesforce-cli%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown









                              Popular posts from this blog

                              Tamil (spriik) Luke uk diar | Nawigatjuun

                              Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                              Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?