+ Start a Discussion
DevSFDevSF 

How To Update Record Owner Field With The Approver Name After Submitting A Record For Approval.

Hi friends,

My Scenario is  :

When a user submitts a record for approval. The the owner of the record should be changed.

It means that "AB" is the  current record owner and he submits for approval for "CD". Then the Owner field on the record should be
changed to "CD".

I need the record owner fields to updated by the approver who approves the record.

I tried using workflow field update which changes the owner name. But i need to specify the user in field update.
If it is assigned to approval for a different user then how to update then....?

Attached is the screenshot of field update.



User-added image



How can i achieve this friends.

Will i need to code or can this be achieved using standard functionalities

Any help friends..!

 
Deepak RathinaveluDeepak Rathinavelu
Hi DevSF,

Using approval process alone it is not possible, you might want to look into Flows for achieving this without code. 


Regards,
Deepak Rathinavelu
DevSFDevSF
Hi Deepak Rathinavelu,

Thank alot for the response.

Do you have any idea of working out this with Visual Flows.
Could  you please help me in completing this task.


Thanks,
Dev
Deepak RathinaveluDeepak Rathinavelu
Hi Dev,

I am assuming that your already know who is going to be the approver of the record.

First, create a lookup to user field in the object you are approving. While creating the record populate the approver.

In the approval process, go to the approval step and change the approver to the related user and select the field you added previously.

This make sure that the approver is set to the user you want to get the approval from. In the field update change the status field to say 'approved'. 
This field update would trigger the process 'change owner'.

Before configuring the process 'change owner'.

Lets take care of the flow.

Goto setup->flow->new

the visual workflow editor would open up.


Drag and drop the record lookup component, and give the name, select the object to view here , and set the criteria as

"ID equals ObjectVariable", objectvariable here is a a variable which can be created on clicking the new variable in the picklist itself.
While creating the variable change the type as 'Input only'. this variables value would be set by the process.

now create another variable to store the newowner value. use the variable assignment section in the record lookup to do this. the user lookup field you created must be selected here and assigned to the new owner variable.

once done drag and drop a record update component, give proper names and select the object. on the field update set the owner field to the variable 'new owner'. save the flow and activate it.

this flow would update the owner. 

Back to our process. create a new process, select the object and select the criteria as create or edit. Set criteria as the status field is 'approved'.
Under acitons add flows, and give a name. Select the flow you created and pass the 'objectvariable' of the flow a value, set it to reference the recordid of the object.
"ObjectVariable references recordid"

save and activate the flow.

Now whenever the record is apprvoed. the owner would change to the person who approved it.

Hope this helps. This is the basic idea, you can play around with it to match it to your needs.

All the best,

Regards,
Deepak Rathinavelu   
 
Bruno RodriguezBruno Rodriguez
Hi,
What I need is when the submitter selects the approver, the field to be updated with the approver selected by the submitter when the process is triggered.
Is this possible?

Regards,

Bruno Molina