Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linter] detect all fields not included in the sfdx project but referenced in at least one email template #372

Open
mickaelgudin opened this issue May 17, 2023 · 4 comments

Comments

@mickaelgudin
Copy link
Contributor

Deployment behaviour
We can deploy email templates to a target org without needing to deploy fields that are referenced in these email templates.

The linter feature in a nutsheel
The idea is to provide a linter feature that allow us to see what fields are not in the sfdx project but are in one of the email templates of the sfdx project.

Example of how fields are referenced in an email template

Dear {!Contact.FirstName},

Thank you for your interest in our product. We are pleased to provide you with the following information:

Account Name: {!Account.Name}
Custom Field Value: {!Custom_Object__c.MyCustomField__c}

If you have any questions or need further assistance, please feel free to contact us.
@nvuillam
Copy link
Member

@mickaelgudin good idea :)

What is the behaviour in case a email template contains a ref to a field that is not existing ?
Is the deployment failing ? Or does it passes then when the email template is used there is an error ?

@mickaelgudin
Copy link
Contributor Author

mickaelgudin commented May 17, 2023

@nvuillam based on the above example the email template would be deployed regardless of whether or not the field Custom_Object__c.MyCustomField__c exist (even if it's a cross object formula there is no check of each fields that are contained in the email template body during deploying).

@nvuillam
Copy link
Member

So there is a clear use case :)

Would you like to build the command hardis:lint:emailtemplates ? :)

@mickaelgudin
Copy link
Contributor Author

No, I'll just leave the idea here since I noticed this behavior on a project.

I think the command hardis:lint:access can be reused specially the part where custom fields are retrieved and based on this we just need to iterate over all email templates and store all field references {!SObject.CustomField__c} and filter to keep only those who are not in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants