<?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>topic Re: HistoricVariableInstanceEntity was updated by another transaction in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185908#M139038</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you share the service-task code you're using? &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2014 07:52:29 GMT</pubDate>
    <dc:creator>frederikherema1</dc:creator>
    <dc:date>2014-08-11T07:52:29Z</dc:date>
    <item>
      <title>HistoricVariableInstanceEntity was updated by another transaction</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185907#M139037</link>
      <description>I'm getting the following error when I submit form data.URL : /service/form/form-dataMethod : POSTPayload : {"taskId":"124104","properties":[{"id":"businessName","value":"10123"}, &amp;lt;a lot of other variables go here&amp;gt;]}Response :{errorMessage: "HistoricVariableInstanceEntity[id=124016, name=testU</description>
      <pubDate>Sat, 09 Aug 2014 18:56:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185907#M139037</guid>
      <dc:creator>texens</dc:creator>
      <dc:date>2014-08-09T18:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: HistoricVariableInstanceEntity was updated by another transaction</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185908#M139038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you share the service-task code you're using? &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 07:52:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185908#M139038</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2014-08-11T07:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: HistoricVariableInstanceEntity was updated by another transaction</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185909#M139039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure why are you doing this code., &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public void execute(DelegateExecution execution) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// loginMobileNumber is taken as input in the preceding user task&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;execution.setVariable(process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if you are trying to set a variable you already have the variable in the execution object?? But this still does not prove the theory of why you get an optimistic lock exception I guess. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 14:09:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185909#M139039</guid>
      <dc:creator>sathish1</dc:creator>
      <dc:date>2014-08-11T14:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: HistoricVariableInstanceEntity was updated by another transaction</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185910#M139040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;HI frederikheremans,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The service task code is as mentioned below. I might have found the issue, currently I'm trying to validate my hypothesis.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my user task, I take an input "loginMobileNumber" from the user. In the service task that follows this user task&amp;nbsp; (user task `Registration User Task` –&amp;gt; Service Task `RegistrationValidator`) , I do some processing on this variable - "loginMobileNumber" and set it to this new modified value in the service task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The flow is something like this :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;User Task `Registration` –&amp;gt; take input "loginMobileNumber" from user (via REST API) –&amp;gt; `RegistrationValidator` Service Task (get the variable value from loginMobileNumber, process it, and then update the variable using - execution.setVariable()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm guessing, when I try to update the same variable twice - once as part of user task form submission, and then as part of the service task variable update, I'm running into the optimistic locking exception because the revision of the variable - loginMobileNumber is different for the two of them. Now, on commit, the user task writes to disk first and updates the revision number. Next, the service task is trying to write to disk, but the revision has already been updated by the user task (increased by 1). So, this results in the optimistic locking exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you please confirm or refute this hypothesis.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;— USER TASK —&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;userTask id="Registration" name="Registration"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;extensionElements&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:formProperty id="loginMobileNumber" name="Login Mobile Number" type="string" required="true"&amp;gt;&amp;lt;/activiti:formProperty&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/extensionElements&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/userTask&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;— SERVICE TASK —&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public class RegistrationValidator implements JavaDelegate {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; @Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; public void execute(DelegateExecution execution) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // loginMobileNumber is taken as input in the preceding user task&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.setVariable("loginMobileNumber", process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; public String process(String loginMobileNumber) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // process mobile number&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return processedMobileNumber;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT : fixed the setVariable line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.setVariable(process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.setVariable("loginMobileNumber", process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 14:16:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185910#M139040</guid>
      <dc:creator>texens</dc:creator>
      <dc:date>2014-08-11T14:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: HistoricVariableInstanceEntity was updated by another transaction</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185911#M139041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Sathish,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There was a typo in my earlier post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- execution.setVariable(process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+ execution.setVariable("loginMobileNumber", process(execution.getVariable("loginMobileNumber")));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm taking the loginMobileNumber as input, and then have a function that processes it (say, to remove country code or preceding 0s) and then I save it to the variable. We can look at it as validation of user input.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 14:20:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/historicvariableinstanceentity-was-updated-by-another/m-p/185911#M139041</guid>
      <dc:creator>texens</dc:creator>
      <dc:date>2014-08-11T14:20:13Z</dc:date>
    </item>
  </channel>
</rss>

