You could also create a onclick javascript detail page button and use the below code.
{!REQUIRESCRIPT( "/soap/ajax/36.0/connection.js" )}
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")};
//Declare variable and match the record
var leadtoUpdate = new sforce.SObject( "Contact" );
leadtoUpdate.Id = "{!Contact.Id}";
if('{!Contact.OwnerId}'=='{!User.Id}'){
leadtoUpdate.User_Same__c = true;
}
else
{
alert('Please own the record to edit it');
}
var result = sforce.connection.update( [leadtoUpdate] );
if ( result[0].getBoolean( "success" ) ) {
window.location.reload();
}
else {
alert( "An error has occurred! Error:" + result[0].errors.message );
}
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
Option 1 . Use this formula to do it .. You no need to create any field update
Option 2. Update the values with workflow
workflow will not support "OwnerId" isChanged function. so you need to create a Trigger for this process.
if you any assitanse or need trigger Please let me know. i will write a trigger for you.
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukes
ISCHANGED will work on OwnerId changes and with "Evaluate the rule when a record is created, and every time it's edited" Evaluation Criteria .
No need for any trigger I believe
You could also create a onclick javascript detail page button and use the below code.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
Thanks,
Sarav
Sweet Potato Tec
Can you please let me know what your code does?
Thanks;
Sarav
Sweet Potato Tec