TransWikia.com

Error when trying to push Lightning EmailTemplates SFDX

Salesforce Asked by d_k on November 8, 2021

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

force-appmaindefault
    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).

3 Answers

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

Answered by d_k on November 8, 2021

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.

Answered by Ysr Shk on November 8, 2021

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

Answered by sdandamud1 on November 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP