+ Start a Discussion
gopikrishnagopikrishna 

automatically change Ownerid

Hi,

 

      How to create automatically change owners.  In my project have 3 users, when 1st user click done button for 2nd user automatically owner change to 2nd owner name and 2nd owner click done button automatically change to 3rd owner name.

 

Thanks

Gopi

PrakashbPrakashb

Are you going to do this through custom button or when you just save the record and it satisfies certain condition then you change the owner.

 

If its the secong scenario you can do it through trigger and for the first scenario you can handle the same in your controller class.

 

*rdinakaran**rdinakaran*

Hi Gopi,

 

You can call an apex method to update the Owner field when you click your Done Button.

 

if(Ownerid == User1.id)
{
	Ownerid = User2.id;
}
else if(Ownerid == User2.id)
{
	Ownerid = User3.id;
}
//update this Ownerid to the Record

 Please let me know it works.

 

Thanks

rdinakaran

krishna1krishna1

Thank you  rdinakaran this helped  for my requirement. Thanks again.