function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
insanedukeposseinsanedukeposse 

is "Record Lock" (from approval process) available in validation rules?

I have a requirement where I would like to lock some fields, but not all fields.

 

Specifically:

1. We have an "approval process" for solutions. We use the "record lock" feature that prevents everyone but the approver from editing the record.

2. The approver needs to be able to edit the solution - i.e. editorial changes to the solution itself, etc.

3. However, there is another field that should be changed. This field changes the nature of the solution, and would drive it down a different workflow process.

4. Once an approval process is initiated, it does not change even if the "entry criteria" have changed. 

5. So...if the field the controls the entry criteria changes (i.e. is not locked) we end up with a bad result (i.e. an approval process is enforced that is no longer valid).

 

If I could simply create a validation rule that was able to check whether the record id "locked" or not, I'd be all set. I would much prefer to use the value set in the approval process, and not have to create a custom field.  

(see this thread: http://community.salesforce.com/sforce/board/message?board.id=custom_formula&thread.id=7581 )

 

 

 

Any help?

 

Ispita_NavatarIspita_Navatar

You can have a field called "Locked" whcih you can set to 1 in one of your initial actions when a record is submitted for "Approval".

Then let say you don't want field "Y" to be changed if a record is locked- So you can have a Validation Rule as follows:-

AND(IsChanged(Y),if(Locked=1,1,0)) and hence an error will be raise.

 

When a record is being either approved or rejected then this field "locked" can be set to 0, which will not fire the validation rule.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

 

 

 

sfdcFanBoysfdcFanBoy

@ispita

 

Yea, that sounds a good idea. Thanks.  But, if I manually Unlock the record and then try to edit the record, the validation still throws error. because the 'Locked' field is still set to '1'. 

 

How do I set the 'Locked' field to 0 when the record is manually Unlocked ?  Any ideas?

 

sfdcFanBoysfdcFanBoy

Or may be we shouldn't give the permission to Unlock the record manually.  Any settings for that?  Please let me know.

 

Thanks,

Manish