0

I have written validation for standard userprofile. This Profile should not able to change the record ownership but its not working.

AND(
  ISCHANGED(OwnerId),
  PRIORVALUE(OwnerId)<>$User.Id,
  $Profile.Name <> "Standard User"
)
1
  • The problem is that it is not allow to save system admin also.
    – user42894
    Commented Mar 20, 2017 at 9:42

1 Answer 1

2

I think you have the logic backwards on the third condition.

As it currently stands, an error will be thrown if the profile name does not equal "Standard User". i. e. only users with the Standard User profile can edit the Owner Id on this object.

AND(
  ISCHANGED(OwnerId),
  PRIORVALUE(OwnerId)<>$User.Id,
  $Profile.Name = "Standard User"
)

This will throw an error when users with the "Standard User" profile change the owner id on on records that they currently do not own.

4
  • do u have code for this?
    – user42894
    Commented Mar 20, 2017 at 9:47
  • AND( ISCHANGED(OwnerId), $Profile.Name = "Standard User" )
    – user42894
    Commented Mar 20, 2017 at 9:54
  • is this correct for validation?
    – user42894
    Commented Mar 20, 2017 at 9:54
  • That validation would throw an error when users with the "Standard User" profile changed the Owner Id of the record, regardless of who currently owns the record. If that's what you want, that should work.
    – martin
    Commented Mar 20, 2017 at 9:59

You must log in to answer this question.