- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2025 05:32 AM
Hello everyone!
I have a flow in flow designer that increments a value in system properties. This value should be readily available to users and every user should get a unique incremented value in a sequence. However, I am running into a problem where multiple users are accessing the same variable from system properties and are receiving duplicate values
This variable should increment every time a unique user accesses it, however when multiple users access it at the exact same time through a flow in flow designer, they receive the same value.
Does anyone have any ideas or experience regarding this issue, it would be greatly appreciated!
Thank you!
Solved! Go to Solution.
- 738 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2025 07:46 AM
Hi,
You'll need to create a custom flow action for this as you'll need to create a mutex. A mutex will ensure exclusive access to the resource and ensure each time it's accessed, a unique value is provided.
For example:
var generateCode = Class.create();
generateCode.prototype = {
initialize: function() {
},
getCodeAndIncrement: function(){
return new global.Mutex.enterCriticalSection('UNIQUE_NAME_FOR_MY_MUTEX' , this, getCode);
},
getCode: function(){
//We use GlideRecord in order to leverage the mutex lock on the record
var lastValue = new GlideRecord('sys_properties');
lastValue.addQuery('name' , 'my.property.name');
lastValue.setLimit(1);
lastValue.setNoCount(true);
lastValue.query();
if(lastValue.next()){
var codeToUse = lastValue.getValue('value');
var newVaue = codeToUse ++;
lastValue.setValue('value' , );
lastValue.update();
return codeToUse;
}
},
type: 'generateCode'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2025 07:43 AM
Hi Kieran
Thank you for your response. I am currently facing a challenge with the integration of the global.Mutex.enterCriticalSection script include, as it resides within the global scope, while my script needs to be executed in a scoped application.
To address this, I'm considering creating a new script include in the global scope , i.e customScriptInclude, that will be accessible across all application scopes. This script include would call the necessary methods from the global.Mutex script include. I plan to invoke this customScriptInclude from my scoped application to effectively access the functionality of global.Mutex.
I would appreciate your thoughts on this approach.
Regards
Watson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2025 08:35 AM
What value does this add?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2025 09:25 PM
It looks like a bot response, @Kieran Anson your answer really helped! Thank you!
