You need to sign in to do that
Don't have an account?
Workflow to capture old value
On the Accounts object i have a custom lookup field called 'Account Manager' of type user.
I also have another custom field 'Previous Manager' of type Text. What I am trying to do is, when the Account Manager is changed,copy the old value of 'Account Manager' to 'Previous Manager. To achieve this, I have created a workflow with the following properties,
Rule Criteria: ISCHANGED(Account_Manager__C)
Field to Update: Previous Manager
Formula Value: PRIORVALUE(Account_Manager__c)
Of course this gives me the record id of the user, to get the Manger's Name (FirstName Last Name) I did,
PRIORVALUE( Account_Manager__r.FirstName & ' '& Account_Manager__r.LastName ),
However it gives me the error 'Incorrect argument type for function 'PRIORVALUE()'
How can I get the Manager's First Name and Last Name?
Thanks!!
If you are looking for a pure declarative solution:
1. Create a formula field on the object that is set to the value of the first name and last name of the relationship
i.e -> FieldName = ManagerName - text value = Account_Manager__r.FirstName & ' '& Account_Manager__r.LastName
2. Set the workflow rule to use the prior value of the formula field you created and put that value in the field you want..
Priorvalue (ManagerName__c)
Thanks for your response.
If I have to do it programatically, is trigger the way to go?
If you are looking for the information in a trigger, you can use the Trigger.old to get the prior value.
Thanks a lot. Just remembered about Trigger.old
It is easier if the Previous Manager Field is a lookup to the User object. This way, if you update it with the record ID, it will show the name.
Thanks, yes the Previous Manager field is a lookup to User.
https://newstechnologystuff.com/2020/12/20/get-old-values-in-record-triggered-flow/