2

Iam trying to simplify my validation rule but i get error. My VR restricts users from role from chaning ownerid for subset of users, since all my users first name is "TBD" i want to simpify the rule by adding owner.firstname, here is my rule

AND(
     OR($UserRole.Id  = "00E30000000vEST",
        $UserRole.Id  = "00E40000001CZB5"),
        ISCHANGED(OwnerId),
        PRIORVALUE(OwnerId) <> "00540000000zpgS",
        PRIORVALUE(OwnerId) <> "00540000000oWNX",
        PRIORVALUE(OwnerId) <> "00540000000lkIN",
        PRIORVALUE(OwnerId) <> "00540000001SyUq",
        PRIORVALUE(OwnerId) <> "00540000001UnYg",
        PRIORVALUE(OwnerId) <> "00540000002FltR",
        PRIORVALUE(OwnerId) <> "00540000002nKbr",
        PRIORVALUE(OwnerId) <> "00540000002JAiR",
        PRIORVALUE(OwnerId) <> "00540000002IeDq",
        PRIORVALUE(OwnerId) <> "00540000002nU49",
        PRIORVALUE(OwnerId) <> "00540000002nU4Y",
        PRIORVALUE(OwnerId) <> "00540000002nU4T"
)

I want to use PRIORVALUE(Owner.FirstName <> "TBD") but i get this error:

Incorrect argument type for function 'PRIORVALUE()'.

Any help is appreciated.

2 Answers 2

3

Unfortunately, you can't reference the field directly, so you have to use a formula:

Field Name: Owner_First_Name__c
Return Type: Text
Formula: Owner.FirstName

Then, you can reference it as such:

PRIORVALUE(Owner_First_Name__c) = 'TBD'
4
  • I even created formula field and tried even text field but looks like i can't use these fields in Priorvalue function, any other ideas ?
    – Admin_BA
    Commented Jul 29, 2014 at 21:25
  • you can try BEGINS(PRIORVALUE(OwnerName)),"TBD") and see if it works.. Commented Jul 30, 2014 at 4:29
  • There is no field called OwnerName. Commented Jul 30, 2014 at 5:44
  • @Admin_BA I've tested this in my developer org, and it works. If you're having trouble, try using the "Insert Field" button and see if that helps. Maybe you should update your question with your latest attempt using the formula field so we can have another try at it.
    – sfdcfox
    Commented Jul 30, 2014 at 5:49
0

Try: PRIORVALUE(Owner.FirstName) <> "TBD"

PRIORVALUE takes a field and results in what the fields prior value was, which should then be compared to your value.

Edit: It does not appear you can use priorvalue function with that field

Error: The PRIORVALUE function cannot reference the Owner.FirstName field.

1
  • Still same error :(
    – Admin_BA
    Commented Jul 29, 2014 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .