<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Incrementing System Properties integer value by multiple users causing duplicate values in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410285#M1234095</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a flow in flow designer&amp;nbsp;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&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas or experience regarding this issue, it would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Oct 2025 12:32:15 GMT</pubDate>
    <dc:creator>WatsonK</dc:creator>
    <dc:date>2025-10-22T12:32:15Z</dc:date>
    <item>
      <title>Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410285#M1234095</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a flow in flow designer&amp;nbsp;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&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas or experience regarding this issue, it would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 12:32:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410285#M1234095</guid>
      <dc:creator>WatsonK</dc:creator>
      <dc:date>2025-10-22T12:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410435#M1234120</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;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'
};&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Oct 2025 14:46:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410435#M1234120</guid>
      <dc:creator>Kieran Anson</dc:creator>
      <dc:date>2025-10-22T14:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410492#M1234131</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/1000500"&gt;@WatsonK&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;script is shared by&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/431446"&gt;@Kieran Anson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try that and share feedback&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 15:23:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410492#M1234131</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-10-22T15:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410525#M1234133</link>
      <description>&lt;P&gt;What value does this add?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 15:35:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410525#M1234133</guid>
      <dc:creator>Kieran Anson</dc:creator>
      <dc:date>2025-10-22T15:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410858#M1234174</link>
      <description>&lt;P&gt;It looks like a bot response,&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/431446"&gt;@Kieran Anson&lt;/a&gt;&amp;nbsp;your answer really helped! Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 04:25:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410858#M1234174</guid>
      <dc:creator>joachimfmen</dc:creator>
      <dc:date>2025-10-23T04:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410927#M1234187</link>
      <description>&lt;P&gt;Good morning&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/431446"&gt;@Kieran Anson&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I am facing the same problem and your suggestion would work perfectly. However, I have to implement this in a custom application scope where global.Mutex is not reachable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Do you have any suggestions for implementing something similar in a scoped application (I am also limited in terms of custom table creation).&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;BR /&gt;- Joa&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 06:20:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3410927#M1234187</guid>
      <dc:creator>joachimfmen</dc:creator>
      <dc:date>2025-10-23T06:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing System Properties integer value by multiple users causing duplicate values</title>
      <link>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3411446#M1234278</link>
      <description>&lt;P&gt;Hi Kieran&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;BR /&gt;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.&lt;BR /&gt;I would appreciate your thoughts on this approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Watson&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 14:43:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/incrementing-system-properties-integer-value-by-multiple-users/m-p/3411446#M1234278</guid>
      <dc:creator>WatsonK</dc:creator>
      <dc:date>2025-10-23T14:43:59Z</dc:date>
    </item>
  </channel>
</rss>

