<?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>Unable to stop the Race conditions in a process model</title><link>https://community.appian.com/discussions/f/process/20318/unable-to-stop-the-race-conditions-in-a-process-model</link><description>When I select the items in the grid and click on the button in the background the process model should trigger, and it must complete successfully, But when I click the button instantly twice or thrice immediately another process model is triggering the</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Unable to stop the Race conditions in a process model</title><link>https://community.appian.com/thread/79313?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 15:11:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d0c4123f-d8a8-42b4-a4d9-4f2f2aaffc35</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;If you need an entire process to run in the background, one thing you might want to consider is actually making the button a submit button.&amp;nbsp; Submit the form, move on in the process, call a synchronous sub-process (so it has to finish before you can move on) and activity chain the whole thing in a massive loop back to the same form you were in.&amp;nbsp; If you can configure it well enough, you might be able to dump the user right back into the same form in such a way they won&amp;#39;t even notice that they left and came back. (It really, really helps if the form is so short that there&amp;#39;s no scrolling.)&lt;/p&gt;
&lt;p&gt;Another thing you could do is simply add a Task Form to your subprocess as a confirmation screen.&amp;nbsp; You load that form in a branch near the beginning.&amp;nbsp; Use an AND gate at the beginning and at the end, so the DB processing AND the form both have to be done before it terminates.&amp;nbsp; The user has to reach over and click the &amp;quot;OK&amp;quot; button to close the form, which does nothing but hide the main form from the user while you complete the write.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t need to do that much processing with other script tasks and such, it is best to avoid the subprocess and just process in a rule you call that calls the a!writeToDataStoreEntity() as suggested below.&amp;nbsp; If it&amp;#39;s simple enough, that is the best approach if you include the toggle to make sure the button can&amp;#39;t be pressed multiple times.&amp;nbsp; Without that, it will seem just like the race condition.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to stop the Race conditions in a process model</title><link>https://community.appian.com/thread/79271?ContentTypeID=1</link><pubDate>Sat, 30 Jan 2021 15:46:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d1bd704b-1ae5-463f-929d-5f864ad683e6</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;To start us off here, why is a process model required to write data to the DB on a button click while the interface is still active?&amp;nbsp; If this is a requirement, note utilizing a!writeToDataStoreEntity() on the button click instead is much lighter and much easier to control.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Additionally, if you set a flag on the button click, users should only be able to click once - potentially reset the flag to false if any data is modified that might need to be persisted to the DB?&amp;nbsp; Otherwise if you can post more details about your configuration and use case, that would assist here.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!buttonClicked: false,
  
  {
    a!buttonArrayLayout(
      buttons: {
        a!buttonWidget(
          label: &amp;quot;Write Data&amp;quot;,
          value: true,
          disabled: local!buttonClicked,
          saveInto: {
            local!buttonClicked,
            a!writeToDataStoreEntity(
              dataStoreEntity: cons!COE_DS_TESTING,
              valueToStore: &amp;#39;type!{urn:com:gdit:types}COE_TESTING&amp;#39;(data: &amp;quot;test&amp;quot;)
            )
          }
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>