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
Dhananjay Patil 12Dhananjay Patil 12 

How to retrieve the previous owner first name in templates

I have a requirement inwhich after changing the record type of an account,it change the owner of account to the new owner as well as send an email alerts to the user.For this I created  a WF rule inwhich I have created 2 WF actions:
1 for the Field updates i.e.change the account type the new user.
then I have created an email servicea and use a custom email template.
Now problem when i receive an email,in the opening of an email I receive new user's first name.But my expection is after changing the owner of the record in the email opening i should receive old user's first name.

e.g.if user Dhananjay create an account  of type "Temporary".account is the another user "DJ" change the record type from "Temporary" to "Customer" then  when Dhananjay receives an email from DJ,in the mail opening it should be start with "Hello Dhannajay" not "Hello DJ".

Following are the email template that i used:

Hello {!User.FirstName} ,
This is to inform you that the account
{!Account.Name} has been verified by the CMDO team and created as a {!Account.RecordType}.
Thank you.

instaed of {!User.FirstName} i used {!Account.CreatedBy},this solved my issue but i want previous users first name only not the complete name.In Created by it gives First name as well as last name which is default.

is there any way i can receive old user's first name even after changing the owner of record?


Just create one more field on Account named as Previous_Owner__c of type text that will hold the previous owner's First name and add this action with your workflow rule at first place, then place the action related to changing the owner and atlast fire the email alert.

I assume your workflow entery criteria is set to ISCHANGED(RecordType).

Aneske Meiring 10Aneske Meiring 10
Have to agree with @pankaj. No other way to retrieve the previous owner unless you store it somewhere
Dhananjay Patil 12Dhananjay Patil 12

Hello @Pankaj_Ganwani @Aneske Meiring 10,

Thanks for the reply.As u mentioned,I have created a field of type text but instead of crating a WF rule I have created a Process Builder because I was not able to add the condition for storing the value of prior owner in the WF rule not sure why.In process builder I have checked the condition first ISCHANGED(Owner Id). then update the action by specifing the field "Previous_Owner__c" and add the formula PRIORVALUE([Account].Owner.FirstName ) and fire the email service..
with the help of process builder i am able to solve this problem successfully.

Thanks for providing the hint.