I have a Salesforce Service enabled Sandbox and I have created some messaging templates in Service Setup/Home/Channels/Messaging/Messaging Templates. I need to retrieve metadata related to those Templates to vs code using sfdx. How can I modify my package.xml to achieve that?


Add the MessagingTemplate object to your package:

  • Im getting this error: ERROR running force:source:retrieve: Element {soap.sforce.com/2006/04/metadata}type invalid at this location – YanetP1988 May 13 '20 at 13:32
  • @YanetP1988 Whoops, yeah, that should have been name, not type. – sfdcfox May 13 '20 at 13:35
  • hahah, no problem. Still, now this: === WARNING: The following metadata isn’t in your org. If it’s not new, someone deleted it from the org. Entity type: 'MessagingTemplate' is unknown – YanetP1988 May 13 '20 at 13:53
  • 1
    @YanetP1988 Interesting. I need to some research on this. It doesn't appear in my dev org. – sfdcfox May 13 '20 at 13:53
  • I've been doing some research and it seems that it is not supported by Metadata API – YanetP1988 May 15 '20 at 15:49

Since it seems that it is not supported by Metadata API, I have found a workaround, with Workbench I queried object Messaging Template:

SELECT DeveloperName,MasterLabel,Message FROM MessagingTemplate

Then in VS Code, exported that result as a JSON file and imported on my other sandbox.

sfdx force:data:tree:export -q "<SOQL query>" -d "<exported file path>"

sfdx force:data:tree:import -f "<exported file path>"

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.