<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting the same value from a expression rule</title><link>https://community.appian.com/discussions/f/general/39413/getting-the-same-value-from-a-expression-rule</link><description>Hi all, 
 
 I have a process model that calls an expression rule to generate a 6-character random alphanumeric string. I encountered a case where two instances of the process model were triggered at the same time (based on time logs), and both received</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149706?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 10:27:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1db9c43b-f856-4a78-9155-ea1bcff04b65</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;Any process instance&amp;rsquo;s id is unique always! If you want random yet unique string then consider using the process id -pp!id- along with whatever code you have for the random string!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149699?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:47:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7df32938-00cd-4183-9323-71acf4ab214c</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;OK, but then you can&amp;#39;t just use a random value. You will get duplicates over time.&lt;/p&gt;
&lt;p&gt;Did you consider to just use the primary key of a record as the identifier? This would guarantee uniqueness. And you can convert that number into an alphanumeric string if needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149698?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:40:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:702de18a-78d9-4737-bb2d-e74ed1cf4dff</guid><dc:creator>jethmrsgn</dc:creator><description>&lt;p&gt;We&amp;rsquo;re using it as an identifier. Unfortunately, we can&amp;#39;t add more characters due to an external system limitation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149697?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:39:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:57f6b2d3-c608-49f3-a951-4ee69beb230f</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Try this code once.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;mid(
  substitute(
    substitute(
      text(now(), &amp;quot;yyyyMMddHHmmssSSS&amp;quot;), 
      &amp;quot;:&amp;quot;, &amp;quot;&amp;quot;
    ),
    &amp;quot; &amp;quot;, &amp;quot;&amp;quot;
  ),
  12,
  6
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I would recommend you to use pp!id with now() to make it more unique combination.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149696?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:37:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19f68048-719c-492b-b2e9-0f50de7e3dda</guid><dc:creator>jethmrsgn</dc:creator><description>&lt;p&gt;Thank you for answering. Is there a way to check this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149695?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:33:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d62a7d29-8b74-4e2b-bb1f-ce63aaea242d</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;6 characters isn&amp;#39;t that much randomness. So, yes, this can happen.&lt;/p&gt;
&lt;p&gt;What do you do with this value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting the same value from a expression rule</title><link>https://community.appian.com/thread/149694?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 06:27:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:92af95aa-7a03-4bb9-8ead-8244be3c2986</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;No, Expression rules don&amp;#39;t share execution threads. Each process instance gets its own separate execution.&lt;br /&gt;Your random generator likely uses system time as a seed. When two processes run at the exact same millisecond, they get the same seed&amp;nbsp; -&amp;gt; same random value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>