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
:) :) :) :) :):) :) :) :) :) 

How can I accept record ownership using Link in email

Is there any way to accept ownership through Link in Email. I want to make  some apex code logic where I click button 'Send owership Email'. It will send out email to number of persons. When first user click on that link he will get the ownership and if second user click that link he will get message that owner is already assgined.

 

Leave out any ideas you have.

 

Thanks  

WaveOCWaveOC
Using the VF page and Apex controller, you may send the link to this page to some users, this link should contain Id of record that you want to change ownership, when they would be redirected you may use "action" attribute within the and put there a method that would automatically change the owner to CurrentUser.Id for record with id in URL. As for this - "When first user click on that link he will get the ownership and if second user click that link he will get message that owner is already assgined." - you may create a checkbox field(i.e. Ownership_Accepted__c) to this object, hide it from layout (if required) and each time you'll click on your "Send ownership Email" button this field value need to be changed to false(this button should Javascipt button), and when somebody will be redirected to this page you need to check if this checkbox is already in TRUE or NOT, if TRUE you may display your message that owner is already assigned, if FALSE assign current user as owner and set Ownership_Accepted__c in TRUE.