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
Sean C.ax1056Sean C.ax1056 

Need to write a VR that prevents a Profile from changing the Account Owner

Hi

I need to restrict a few Profiles from changing the 'Lead Owner' and 'Accout Owner' fields on records that they actually own.

 

I have managed to build a Lead VR, with some help from SteveMo, that works nicely:

NOT(ISNEW())
&&
AND (( $Profile.Name=='Business Development Manager' ||
$Profile.Name=='Standard User' ||
$Profile.Name=='Read Only' ), ISCHANGED(OwnerId))

This VR allows a New Lead to be created, saved and converted, but stops a Lead being re-assigned by these 3 Profiles after it's created.

But I still haven't been able to write an Account VR that doesn't interfere with a Lead being converted.

Any ideas or advice would be appreciated. Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

You have to write the similar type of validation on account object to do this. I am considering only one profile i.e. “Standard User” to prevent change the account owner.

Like this:

 

NOT(ISNEW()) && AND (( $Profile.Name=='Standard User' ), ISCHANGED(OwnerId))

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You have to write the similar type of validation on account object to do this. I am considering only one profile i.e. “Standard User” to prevent change the account owner.

Like this:

 

NOT(ISNEW()) && AND (( $Profile.Name=='Standard User' ), ISCHANGED(OwnerId))

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
Sean C.ax1056Sean C.ax1056

Yes, works nicely. Thanks.

 

Could have sworn that when I tested using the same VR in Accounts that it didn't work first time I tried.

 

Thanks for making me check again. Cheers.