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
RemediosRemedios 

Change the record owner with the currently logged in user

I am trying to do the following:

 

Upon checking a box to have a folloup task/evnt to be created for the logged in user. I have two issues: most of the record owners belong to admin personnel (they are those adding accounts to SF) and I can't create an event with the workflow rules.

 

So I was thinking: is there a way to make the record owner updated/replaced with/by the logged in user when the box for a specific field is checked?

 

If i want to create an automatic event for let's say 30 day followup when another field is updated (checkbox = true) - what' the best way?

 

Thank you!!!

VJSFDCVJSFDC

hi ,

 

I dont think there is a way to update the  Task Owner field with the current logged in user using Workflow Rules functionality.

 

In fact you can write a trigger to check if the particular field is checked and then update the Task Owner to the current logged in user with the help of below script:

String userId = UserInfo.getUserId(); 

String firstName = UserInfo.getFirstName();

String lastName = UserInfo.getLastName();

 

Hope it helps.