0

I have a group of users with the same profile (standard user) and I need to lock records from editing that they own when the Campaign status field equals Completed. However, they need to be able to edit the campaign record to completed if the status is any other value. So, I only need to lock the record from editing after it has been updated to completed.

I created a validation rule that prevents them from being able to edit the record if the status is already completed. However, when they need to update records that are not yet completed the validation rule fires of course and they get an error.

What approach should I take to accomplish this that does not involve apex as we have a low code environment?

Here is my Validation Rule: AND ( NOT(ISNEW()), NOT(ISBLANK (PRIORVALUE ( Status ))) )

Message: The Status of this Campaign is Completed. You cannot edit this record. Please contact your system administrator.

2
  • 1
    Could you please edit the question adding the validation rule you wrote?
    – RubenDG
    Aug 19, 2023 at 6:36
  • I tried the below. It looks like the Validation Rule is still triggered when a standard users tries to change the status to completed. I need the validation to fire only after the record is already in the completed status and they try to edit any field. I also applied a permission set that by-passes the validation for power and sys admin users and that is working fine.
    – Ron
    Aug 21, 2023 at 3:32

1 Answer 1

0

You VR would need to be:

AND(
    NOT(ISNEW()),
    ISPICKVAL(Status, "Completed")
)

This would run the VR whenever the Status is Completed.

Although I'd probably suggest looking into something that's a bit more foolproof. I would use an Approval Process to lock the records once they have gone to Completed, which means that staff wouldn't even have the chance to click edit on them and bit hit by the VR, it's a bit of a cleaner UX for staff.

You can use a Flow to submit the record for Approval when the Status updates and just not do any logic, only have the record being locked and leave it as that. That way you can also allow Admins to bypass the record lock and make amendments if needed.

Flow Approval Action: https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_actions_approval.htm&type=5

Approval Record Editability: https://help.salesforce.com/s/articleView?id=sf.approvals_create_recordeditability.htm&type=5

3
  • This is exactly what I need to happen. Admins and power users should have access to edit once it is locked. Thanks for your help Tim.
    – Ron
    Aug 20, 2023 at 20:43
  • So the validation runs now and locks the record from editing any other fields when the status is saved as completed. However, I can still edit the status field. My requirement is to lock all fields, including the status field, once the record has been saved as status=completed. My validation looks like this: $Permission By_Pass_Validation_Rule=False&& AND( ISPICKVAL(Status, "Completed"), NOT(ISCHANGED(Status)), OR( ISCHANGED(Name), ISCHANGED(Paid_Event__C), ISCHANGED(Business)) )
    – Ron
    Aug 26, 2023 at 3:39
  • You need to create and add a Custom Permission to either a Profile or a Permission Set and you can check that in your formula: $Permissions.Custom_Permission_API_Name
    – Tim
    Aug 26, 2023 at 7:18

You must log in to answer this question.

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