AnsweredAssumed Answered

Is there a best practice in FM to lock a group of records without using db record locks?

Question asked by edpod2101 on Apr 23, 2015
Latest reply on Apr 24, 2015 by edpod2101

I have designed an order fulfillment solution that supports multiple users filling orders.  Once an order is entered it may be selected from a queue by someone who picks and ships the items.  These are multi-line orders so the process can start and stop.  If the fulfillment process is started I am updating the order record with the user (Account Name).  Anyone trying to access that order, the associated order lines, the order picking, or order shipping is stopped by a script that checks the In Use field on the Order record to determine if the account name value is different from their own (users must user different accounts).  If the process is not completed, i.e. the user leaves the layout for the order or the related records, the order is updated leaving the In Use field empty.  The process can be completed by a different user at a later time.


I'm using OnLayoutEnter and OnLayoutExit to trigger the script to check for and update the In Use field on the Order record.  This solution is working.  Though I'm finding that the OnLayoutExit doesn't always fire.  This is still puzzling me.  I'm investigating the conditions under which this does not occur.  It seems like once I think I understand triggers something else surprises me. The FM script trigger reference document was only marginally useful.


I admit that I am not the biggest fan of script triggers.  It seems to me that relying on them can be a little risky.  But this seems like the only way to lock out users from working on a process related to a record where multiple layouts and multiple related records are involved.  In my case, once the Order is selected all the downstream processes need to be locked until the user leaves that order.


So while the solution appears to be working I am still a little uncomfortable with it.  And I'm left wondering if there is a better approach.  How are you accomplishing this in your solutions?