Jump to content
  • 1

Lock record for editing based on workflow




I have a use case where employees create a record that their manager then approves. So far I've blocked the employee from editing the record but I need to allow them to edit, rather than create another new record. This is easy enough to do, but now I have the scenario where both the employee and the manager may edit the record at the same time, and if this could lead to a manager approving something they've not actually seen.

I've looked at the 'lock record when in use' example suggested by Chad - and thought I could use the autosubmit to change my workflow field so it can't be edited if the manager doesn't have the record open. However, because both of the employees datapage and the managers datapage has a redirection, to do this workflow, I think I need to create a separate page first that changes the workflow (which will remove the record from the view) and lock the record whilst its being edited. Does this sound like the best workflow? Does anyone have better options/ alternatives?



Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

The idea I have in mind is similar but involves a trigger and rules instead. 

A. Create a new field on the table just like in the forum post. Two text255 fields. The one for 'pending_approval' and the other for 'Last updated By'.

B. On your editing datapage, create a calculated value that will check the value of the 'pending_approval' field.  If it's equal to 'pending', this means that it has been updated recently and is pending approval, all of the fields are set as 'display only'  by the rules. Otherwise, the rules will set the fields as normal. 

The 'last updated by' should capture the ID of the user.

C. I will also set a triggered action that will delete the #inserted if the records 'pending_approval' = pending.'  So the updates will not overwrite. if not, there's an update block next to it to set that field value to pending. 

D.  A datapage for approval or decline should set the value of the field 'pending_approval' either to 'approve' or 'reject'.

You will save a datapage with this setup. The problem on this however is that, if multiple users have edited the record at the same time, only one of them will get in.  It's probably the first one that will be submitted.

Link to comment
Share on other sites

  • 0

Some adjustments as well.

For B:

I will also set the rule to check if the 'last updated by' value is equal to the current user's ID. So Basically, the fields will become displayed only with the condition of the 'pending_approval' = pending and 'last updated by' not equal current user's ID.

C. The trigger will also have to check if the new 'last updated by' value is equal to the field's previous value. Otherwise, delete the #inserted.

I hope this helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...