function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Maurice LopesMaurice Lopes 

Create a trigger to convert email to lower case and update another field with the email address

Good Afternoon,

I need to create a trigger for the following requirement.

Add a trigger to Salesforce that automatically converts Account Email address to lower case & updates the Customer ID field with that email address.  Account Email and Customer ID fields are both located on the account page layout (Person Account).

Thank you







 
Best Answer chosen by Maurice Lopes
SarfarajSarfaraj
Maurice, Thank you for the information. Please change the formula in both the field update actions, "Update Account Email to Lowercase" and "Update Customer ID" from, LOWER(PersonEmail) to this, LOWER(cashbox__Account_Email__c) ​--Akram

All Answers

SarfarajSarfaraj
Hi Maurice,

You do not any trigger to meet your requirement. Create a workflow rule on Account object to do the field update operations. Please find below the details you need to configure the workflow. Do not forget to activate the workflow after you create it.
User-added image
User-added image
User-added image

--Akram
Maurice LopesMaurice Lopes
@Akram

Thank you for the suggestion.  Being new at this, can you share the rule criteria you created for the workflow shown above?

Thank you,

Mauricce
 
SarfarajSarfaraj
Rule criteria is true. Like this,
User-added image
Maurice LopesMaurice Lopes
@Akram,

Thank you.  I created the flow, but it is not working.The Account Email is object from an app we installed and the same for Customer ID.

See attached....

User-added image

User-added image
Maurice LopesMaurice Lopes
I am going to remove Account Email from the page layout and insert Email field instead.  As for customer ID, this is a custom object from Cashbox, so hopefully by making this change I can get the customer ID to populate with email address.
SarfarajSarfaraj
I need more information to comment on this. Please let me know the object structure and api names of the fields. In case you need assistance in finding out these information, please create a user with system admin right for me if your org. My email is sarfarajey at gmail dot com.
Maurice LopesMaurice Lopes
Account Email = cashbox__Account_Email__c

Customer ID = cashbox__Customer_Id__c
Maurice LopesMaurice Lopes
User-added image
Maurice LopesMaurice Lopes
User-added image
SarfarajSarfaraj
Maurice, Thank you for the information. Please change the formula in both the field update actions, "Update Account Email to Lowercase" and "Update Customer ID" from, LOWER(PersonEmail) to this, LOWER(cashbox__Account_Email__c) ​--Akram
This was selected as the best answer
Maurice LopesMaurice Lopes
@akram

Thank you, I will be testing this tomorrow and let you know if it works.
Have a great day!

Maurice