0

I have a requirement where if the record has been sent for approval/approved/rejected (via the Approval status field), the record should not be allowed to be edited, with exception of Comments field, which can be edited even if the record has any of the above mentioned approval statuses. How to achieve this via validation rules?

My current validation rule is posted below, not sure how to add the exception of Comments field to this rule. I only want the comments field to be edited, nothing else.

AND(
NOT($Permission.Bypass_Validations),
$Profile.Name <> "System Administrator",
OR(
ISPICKVAL(ApprovalStatus__c,'Approved'),
ISPICKVAL(ApprovalStatus__c,'Rejected'),
ISPICKVAL(ApprovalStatus__c,'Pending')
)
)

1 Answer 1

1

To allow editing of the Comments field while preventing editing of other fields when the Approval Status field is Approved, Rejected, or Pending, you can use a validation rule like this:

AND(
 NOT($Permission.Bypass_Validations),
 $Profile.Name <> "System Administrator",
 OR(
  ISPICKVAL(ApprovalStatus__c,'Approved'),
  ISPICKVAL(ApprovalStatus__c,'Rejected'),
  ISPICKVAL(ApprovalStatus__c,'Pending')
 ),
 NOT(ISCHANGED(Comments)),
 NOT(AND(ISNEW(), ISBLANK(Comments)))
)

This validation rule will prevent the record from being saved if any field other than Comments is edited, or if a new record is being created and the Comments field is blank. Note that this validation rule will only apply when the Approval Status field is Approved, Rejected, or Pending. If the Approval Status field has a different value, the validation rule will not apply and the record will be editable as usual.

This answer was given by chat gpt. I wonder if this can be used to answer most questions here :) it seems to be accurate something like 90% of time for me.

2
  • Had a lot of luck with formulas and chatGTP as well, seems like a golden combination.
    – userRR
    Jan 3 at 22:20
  • This validation rule will allow you to edit anything as long as the comments field is changed as well in the same transaction. Mar 30 at 15:33

You must log in to answer this question.

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