In Salesforce, scratch orgs are temporary and disposable environments primarily used for development and testing. By default, these scratch orgs are configured without the ability to send email notifications. This limitation is in place to prevent accidental or unauthorized emails from being sent from scratch orgs.
However, a workaround is available to enable email notifications in scratch orgs. This workaround involves verifying the email addresses of the system administrators associated with the scratch org. Salesforce allows sending email notifications from scratch orgs only after the email addresses of the system administrators have been verified.
In this blog, I will be guiding you on how to send emails from scratch org. Let’s see the step-by-step process of it. For example, I will show you the solution using this requirement on the Case object when the case status is working, we send an email to the related Contact. Make sure the email field of Contact is not empty while you test the functionality.
Verify your email address
a. From gear select setup
b. Search User click on users
c. Reset password for a user with System Administrator
2. Create Flow
a. Send an email when the case status is ‘working’
Step 1- Create flow on Record triggered flow
Step 2-
a. Start flow for case object on Record is created or updated
b. Add condition
c. Optimize the flow for:
Step- 3 - Add Decision Element
Check if the contact Email is not null
Step- 4
Add send action element
Add label to it
Create a text template resource for the body
4. Select recipient address
5. Add subject
Step-5
Save and Activate the flow.
Conclusion
While scratch orgs in Salesforce are initially configured without the capability to send email notifications, a workaround is available by verifying the email addresses of the system administrators associated with the scratch org. This process allows developers and administrators to enable email notifications for testing and development purposes. However, it's essential to exercise caution when enabling this functionality to avoid unintended emails and to thoroughly test any email-related features before deploying them to production environments.
If you'd like to see the code and resources used in this project, you can access the repository on GitHub.To access the AVENOIRBLOGS repository, click here. Feel free to explore the code and use it as a reference for your projects.
Thank You! You can leave a comment to help me understand how the blog helped you. If you need further assistance, please contact us. You can click "Reach Us" on the website and share the issue with me.
Reference
https://www.avenoir.ai/post/send-email-to-queue-members-using-flow
https://www.avenoir.ai/post/how-to-send-email-template-with-table-from-flow-salesforce
https://help.salesforce.com/s/articleView?id=sf.flow.htm&type=5
https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs.htm
Blog Credit:
A. Agrawal
Salesforce Developer
Avenoir Technologies Pvt. Ltd.
Reach us: team@avenoir.ai
Are you in need of Salesforce Developers?
Reach Us Now!
● .
Comments