1

I'm trying to push two email templates along with other metadata using SFDX. Here's the folder structure:

force-app\main\default
    applications
    email
        Demo_Email_Templates
            FirstEmail.email
            FirstEmail.email-meta.xml
            SecondEmail.email
            SecondEmail.email-meta.xml
        Demo_Email_Templates.emailFolder-meta.xml
    flexipages

When I try to push my metadata with the Demo_Email_Templates folder I receive the following error:

Error N/A To store the email template in the public folder, enter the Salesforce organization ID. To store it in a user’s private folder, enter t that user’s ID.

Error N/A Custom Object Definition ID: bad value for restricted picklist field: My_Object__c'

Demo_Email_Templates.emailFolder-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<EmailFolder xmlns="http://soap.sforce.com/2006/04/metadata">
    <accessType>Public</accessType>
    <name>Demo Email Templates</name>
    <publicFolderAccess>ReadWrite</publicFolderAccess>
</EmailFolder>

Meta XML for My_Object__c

<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
    <available>true</available>
    <description>some description</description>
    <encodingKey>ISO-8859-1</encodingKey>
    <name>Notify People</name>
    <relatedEntityType>My_Object__c</relatedEntityType>
    <style>none</style>
    <subject>Revisions are requested on your Concept Note</subject>
    <type>custom</type>
    <uiType>SFX</uiType>
</EmailTemplate>

Email Template for My_Object__c

<html>
 <head> 
  <title></title> 
 </head> 
 <body style="height: auto; min-height: auto;">
  Dear {{{Recipient.Name}}}, 
  <br /> 
  <br /> Dummy Text XYZ {{{My_Object__c.Name}}}. //I tried removing this line as well
  <br /> 
  <br /> Regards, 
  <br /> {{{Sender.Name}}} 
  <ul> 
  </ul>
 </body>
</html>

Do I need to add a setting in the dx JSON definition file? What else am I missing?

Edit: These Email Templates will be packaged (managed package).

6
  • How you're triggering mails?
    – Ysr Shk
    Jul 21 '20 at 17:58
  • The templates are going in a package, users can choose to fire them how they like. @YsrShk
    – d_k
    Jul 22 '20 at 5:42
  • Yeah I have unlocked package and its created in package.
    – Ysr Shk
    Jul 22 '20 at 9:21
  • I did not see where is the lightning is mentioned in your configuration. I am having email template in unlocked package.
    – Ysr Shk
    Jul 22 '20 at 9:35
  • It's a managed package
    – d_k
    Jul 22 '20 at 9:38
0

i also faced same issue. when ever your EmailTemplate's exist in your custom folder, you need add that folder Developer name also in you package.xml.

in my case test for me as my custom folder, type is Email.

enter image description here

Package.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
 <members>test_for_me</members>
 <members>test_for_me/contact_response_Confirmation</members>
 <name>EmailTemplate</name>
</types>
  <version>48.0</version>
</Package>

command:

sfdx force:source:deploy -x ./manifest/package.xml -u mytargetorg
3
  • I'm not deploying using deploy command I'm just doing a normal push. How would using a manifest help? Or is this only way to push Email Templates to an org?
    – d_k
    Jul 21 '20 at 17:06
  • i believe your using scratch org, yes you can use push instead of deploy but rest of thing same. in your case folder is different metadata component and emailtemplate is different. 1) create manifest folder then 2)reate package.xml file in manifest folder then 3)add code what ever i provided then run command
    – sdandamud1
    Jul 21 '20 at 17:22
  • No what I meant to say is that there is no difference it's giving me the same issue.
    – d_k
    Jul 22 '20 at 5:33
0

Error N/A To store the email template in the public folder, enter the Salesforce organization ID. To store it in a user’s private folder, enter t that user’s ID.

I had similar issue, where I was doing 2 mistakes -

  1. I did not have set Workflow User configuration (because I was using Email Alert from Process Builder and to send email, I was using workflow user)
  2. I was sending Unified public folder.

For first issue I added below part in project-scratch-def.json -

{
  "orgName": "<Some-Org-Name",
  "edition": "Enterprise",
  "features": ["DefaultWorkflowUser"] 
}

For second issue, I used another folder with public access, which I can see you did it correct.

Error N/A Custom Object Definition ID: bad value for restricted picklist field: My_Object__c'

This is mostly because,either there is picklist which is restricted(to store predefined values) not directly here, somewhere in the flow/related files.

2
  • The second issue is resolved when I remove the email templates so not sure if it is something else.
    – d_k
    Jul 22 '20 at 5:32
  • Tried your approach didn't work
    – d_k
    Jul 22 '20 at 5:45
0

Silly me, Lightning Email Templates can't be packaged, more info here.

3
  • Here they're claiming its supported. Link - developer.salesforce.com/docs/metadata-coverage/49
    – Ysr Shk
    Jul 22 '20 at 9:20
  • Not really if you follow the link once you click on EmailTemplate it will tell you that it's not supported, it's also the link I mentioned above.
    – d_k
    Jul 22 '20 at 9:37
  • But in that line, they have sign to denote that its supported. [for managed one]
    – Ysr Shk
    Jul 22 '20 at 11:42

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.