+ Start a Discussion
Michelle Daniels 89Michelle Daniels 89 

validation rule that record can only be closed by owner

I'm trying to create a validation rule on a custom object where the record can only be closed by the owner of the record. My formula does not seem to be working for some reason. It allows anyone to continue to close without throwing the validation error. Does anyone have any ideas?

AND(Owner:User.Id  <> $User.Id, ISPICKVAL( Status__c, "Closed"))
Murali MattaMurali Matta
Hi Michelle,

Use below code.

AND(Owner:User.Id  <> $User.Id, ISCHANGED(ISPICKVAL( Status__c, 'Closed')))

Let me know if you have any confusion.

Kindly mark this as solved if the reply was helpful.

Thanks,
Murali
Michelle Daniels 89Michelle Daniels 89
Hi Murali,

When I check the syntax for the code listed above I get the following error:  Error: Incorrect argument type for function 'ISCHANGED()'.

Any ideas?
Murali MattaMurali Matta
Hi Michelle,

AND(ISCHANGED(Status__c),ISPICKVAL(Status__c,"Closed"), OwnerId <> $User.Id )

Let me know if you have any confusion.

Kindly mark this as solved if the reply was helpful.

Thanks,
Murali
Michelle Daniels 89Michelle Daniels 89
I figured out a solution:  AND(Owner:User.Id  <> $User.Id, ISCHANGED(Status__c))
Thanks for leading me in the right direction!
Murali MattaMurali Matta
Hi Michelle,

No problem Michelle.
Hope above formula works for you.

Thanks,
Murali
Michelle Daniels 89Michelle Daniels 89
For some reason if I add a portion to the end of the formula then it makes the beginning of the formula invalid and no longer makes it so that the record can only be closed by the owner of the record...however I also need this field specified to not be blank.  Ideas?

AND(Owner:User.Id  <> $User.Id, ISCHANGED(Status__c), ISBLANK( Competitor__c ))
 
Murali MattaMurali Matta
Hi Michelle,

Try this.

AND(Owner:User.Id  <> $User.Id,ISPICKVAL(Status__c,"Closed"),ISCHANGED(Status__c), ISBLANK( Competitor__c ))

Thanks,
Murali
Michelle Daniels 89Michelle Daniels 89
Hi Murali, This formula keeps it so the record can only be closed by the owner of the record but it does not make it so that the specified field is not blank. I tried it with the field blank and it did not throw an error.
Murali MattaMurali Matta
Hi Michelle,

Can you please Explain your criteria?

Thanks,
Murali
Michelle Daniels 89Michelle Daniels 89
I need the record owner to be the only one to be able to close the record and only be able to close the record if the field Competitor__c is not blank.