- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2019 03:59 AM
Hi
I need to write a script that is executed whenever a record is inserted into my "main" table. Based on some criteria the user has selected in the form I need to
- Query a "counters" table
- Increment the counter value
- Update the counters table with the new maximum value
- Use the counter value in the record I'm inserting
All of the above I'm OK with. What I want to know is; how do I lock the row in the counters table to prevent another user from performing the same update at the same time and getting the same counter value as me?
In pure SQL terms I would use a "select for update" on my counter table to lock the row. But I have been unable to find an analogous gliderecord method to do something similar.
I could create a workflow and use a workflow lock, but this seems like overkill for something I should be able to do in a single small script.
Anyone have any suggestions?
Regards
David
Solved! Go to Solution.
- Labels:
-
Scripting and Coding