2

I have created a Salesforce Integration user in production with the Minimum Access - API Only Integrations profile and Salesforce API Integration PSL. I also created a custom permission set where I add the relevant permissions that should enable the user (using SFDX CLI) to run:

sf project deploy start -d ./force-app -o my-org -l RunLocalTests --dry-run --concise 

I have been running the above command and adding permissions to the custom permission set for any errors that are reported during the dry run.

There is one error that is related to classic email templates that I cannot seem to resolve:

Not available for deploy for this organization 

The classic email templates are located in /force-app/main/email/EMAIL_TEMPLATE_NAME. They all are Visualforce email templates.

I have tried the following:

  • I have given the permissions as per this Salesforce help page for classic email templates.
  • I have given the permission Author Apex
  • I have given the permission Customize Applications and Manage Public Classic Email Templates as per this Salesforce help page which covers the creation of Visualforce email templates
  • I have ensured that these templates are in production
  • I have ensured that the folders are accessible for all users
  • Checked that these Visualforce templates cannot be added under Visualforce Page Access permissions (they cannot)

I have also tried retrieving the metadata as per this answer with the command:

sfdx force:source:retrieve -m EmailTemplate:Custom_Template/Claim_Notification 

and got the error message:

Entity type 'EmailTemplate' is not available in this organization 

I have run out of ideas and I would really appreciate it if anyone can point me in the right direction where I can go look for the relevant permissions needed.

UPDATE:

I pulled some text emails into my repo with a Sys Admin user. I switched over to the Integration User and tried to deploy the text email templates. Same issue occurred as for the Visualforce email template, which confirms that it is a Email Template wide issue.

I came across this answer which mentioned a permission EmailTemplateManagement that could be the cause of not being able to access the email templates. I used Perm Comparator to compare a Sys Admin user with the Integration user:

enter image description here

The screenshot shows differing User Permissions between the two users. The Integration User does not have the EmailTemplateManagement permission.

How do you assign this permission in a permission set?

Thanks!

0

1 Answer 1

1

I do work at Salesforce, but not at all related to anything regarding this

So you're correct - I believe the missing permission is EmailTemplateManagement which is used to guard access on the EmailTemplate entity.

However, that permission isn't available to set on Salesforce Integration license or even on an empty permission set, in the UI.

Yet, it seems available to change through the metadata on a permission set. I created a new permission set with no license. Went into workbench, used the ID of the permission set, saw the permission and could update it. Data --> Update with the permission set ID.

enter image description here

enter image description here

enter image description here

Let me know if that works - can't seem to find why the permission itself isn't visible in the UI otherwise or if the above is truly the only way to accomplish it (and expected behavior). Will edit if I find out anything else. You may want to create a case if you haven't already.

1
  • Thanks for this! I used VS Code, retrieved the Permission Set's metadata, added the permission and deployed it back to the org. The user can now access the email templates. Commented Aug 2, 2024 at 6:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.