<?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: Update Workflow Task Property via JavaScript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298446#M251576</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try &amp;lt;blockcode&amp;gt;task.setProperties(properties);&amp;lt;/blockcode&amp;gt; instead. It appears that in this instance, the &amp;lt;blockcode&amp;gt;task.properties&amp;lt;/blockcode&amp;gt; is mapped to the getProperties() method, but the assignment is not mapped to the setProperties() equivalent. This is also an oddity of the JavaScript-Java boundary - the get/set methods don't always align properly based on parameter type definition and runtime resolution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Apr 2013 08:10:52 GMT</pubDate>
    <dc:creator>afaust</dc:creator>
    <dc:date>2013-04-11T08:10:52Z</dc:date>
    <item>
      <title>Update Workflow Task Property via JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298443#M251573</link>
      <description>Hi all,How can I update a task property using JavaScript? The code below does not work:&amp;lt;javascript&amp;gt;var task = workflow.getTask("jbpm");task.properties["wf:destinationUser"] = "new.user";task.save();&amp;lt;/javascript&amp;gt;Anyone?Sure it must be simple, but i can find it anywhere.Thanks!João</description>
      <pubDate>Wed, 10 Apr 2013 09:39:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298443#M251573</guid>
      <dc:creator>joaotpd</dc:creator>
      <dc:date>2013-04-10T09:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update Workflow Task Property via JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298444#M251574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you can't update the properties of a task like you would on a node. What you should be able to do is the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var task = workflow.getTask("jbpm");&lt;BR /&gt;var properties = task.properties;&lt;BR /&gt;properties["wf:destinationUser"] = "new.user";&lt;BR /&gt;task.properties = properties;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no need to call save() as the assignment will already trigger the update in the database. Please note that this code, while apparently trivial and using a seemingly unnecessary re-assignment, is required due to the way the JavaScript environment and the involved Java objects interact.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 11:40:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298444#M251574</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2013-04-10T11:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update Workflow Task Property via JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298445#M251575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Alex and many thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried the code that you suggested, but does not work. More specifically the last line. I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;javascript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Java class "org.alfresco.repo.workflow.jscript.JscriptWorkflowTask" has no public instance field or method named "properties"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/javascript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suppose I can "get", but I can't "set"…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?! …&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;João&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 22:24:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298445#M251575</guid>
      <dc:creator>joaotpd</dc:creator>
      <dc:date>2013-04-10T22:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update Workflow Task Property via JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298446#M251576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try &amp;lt;blockcode&amp;gt;task.setProperties(properties);&amp;lt;/blockcode&amp;gt; instead. It appears that in this instance, the &amp;lt;blockcode&amp;gt;task.properties&amp;lt;/blockcode&amp;gt; is mapped to the getProperties() method, but the assignment is not mapped to the setProperties() equivalent. This is also an oddity of the JavaScript-Java boundary - the get/set methods don't always align properly based on parameter type definition and runtime resolution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 08:10:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298446#M251576</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2013-04-11T08:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update Workflow Task Property via JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298447#M251577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It works! Thanks for the help Alex… and the explanation …&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;João&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 23:21:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/update-workflow-task-property-via-javascript/m-p/298447#M251577</guid>
      <dc:creator>joaotpd</dc:creator>
      <dc:date>2013-04-11T23:21:00Z</dc:date>
    </item>
  </channel>
</rss>

