swetzel

Record Locking to Prevent Edits

Discussion created by swetzel on Jun 14, 2018
Latest reply on Jun 15, 2018 by ThierryGuemboura

I have a concept I am trying to utilize to lock a record to prevent edits.  In my sandbox table I have 4 fields A, B, C, and Lock.  All are Text fields, Lock can only be YES or NO.  If Lock = YES, the record cannot be edited.

 

On my Layout I have created a script which is triggered by OnRecordCommit.  The script is:

 

 

If [ RecordLocking::Lock = "YES" ]

Set Variable [ $key; Value:RecordLocking::PrimaryKey ]
Show Custom Dialog [ Title: "Record Locked"; Message: "The record is locked and will not be changed. The record will be

reverted to it's origional contents."; Default Button: “OK”, Commit: “Yes” ]

Revert Record/Request

[ No dialog ]

Go to Record/Request/Page [ RecordLocking::PrimaryKey = $key ] [ No dialog ]

Refresh Window End If

 

 

Everything works fine.  If I edit the record the edits are undone (reverted) but after the script runs I end up on a different record.  I was hoping Go to Record/Request/Page would have taken me back to the original record but I is not doing that.

 

Why is it not doing that and is there a way I can get that done?

Outcomes