Customize 'From Address' when sending email from Salesforce #inSalesforce
Organization-Wide Email Addresses: Define organization-wide email addresses, which can be used as the "From Address" when sending emails. These addresses can be associated with objects like Cases, Opportunities, or custom objects, and they are typically used for automated processes. Organization-wide email addresses are not dynamic and cannot be changed based on individual users or cases.
Apex Code and Triggers: You can use Apex code and triggers to customize emails' "From Address". You could write a trigger that fires when an email is sent and dynamically changes the "From Address" based on specific conditions or data in the record. For example, you could use the email address of the Case owner as the "From Address" when a Case is updated or closed.
e.g.
for (Case c : Trigger.new) {
if (Trigger.isInsert || Trigger.isUpdate) {
User caseOwner = [SELECT Email FROM User WHERE Id = :c.OwnerId LIMIT 1];
c.FromAddress__c = caseOwner.Email;
}
}
}
Comments
Post a Comment