<?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: TaskListener FormProperties in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101089#M70129</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post your solution? 10x&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Feb 2012 05:47:16 GMT</pubDate>
    <dc:creator>roig</dc:creator>
    <dc:date>2012-02-23T05:47:16Z</dc:date>
    <item>
      <title>TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101083#M70123</link>
      <description>Hi,how can I get access to form properties (TaskFormData) in the TaskListener.I set the event to "create" and tried to load the data from the FormService.Here you can see my code snippet:@Overridepublic void notify(DelegateTask delegateTask) {&amp;nbsp; TaskEntity task =(TaskEntity)delegateTask;&amp;nbsp; FormService</description>
      <pubDate>Fri, 17 Feb 2012 11:28:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101083#M70123</guid>
      <dc:creator>ovonel</dc:creator>
      <dc:date>2012-02-17T11:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101084#M70124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are trying to query the form service using the task instance id. What you are really looking is to get the task definition id. Do so by querying the runtime service using the process definition id/process instance id you gave in the delegate task object. After you get the task definition id, then use your code snippet. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck. I will post a snippet on Sunday.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 11:42:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101084#M70124</guid>
      <dc:creator>roig</dc:creator>
      <dc:date>2012-02-17T11:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101085#M70125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply. I am very excited to see your sample snippet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I cant find the task definition id. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible that if I am trying to query the database for the task id (delegateTask.getId()), it is not yet stored there?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 14:17:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101085#M70125</guid>
      <dc:creator>ovonel</dc:creator>
      <dc:date>2012-02-17T14:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101086#M70126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you can use getTaskDefinitionKey() on your DelegateTask.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;michael&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 17:27:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101086#M70126</guid>
      <dc:creator>gant</dc:creator>
      <dc:date>2012-02-17T17:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101087#M70127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As I have said, you can do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;…&lt;BR /&gt;//you can query how ever you want using the task definition key&lt;BR /&gt;List&amp;lt;Task&amp;gt; processTasks = processEngine.getTaskService().createTaskQuery().taskDefinitionKey(delegateTask.getTaskDefinitionKey()).orderByTaskCreateTime().desc().list();&lt;BR /&gt;//lets assume I know that only the first place is of my interest. We also need to check that we got something back from the query - I skipped that&lt;BR /&gt;processEngine.getFormService().getTaskFormData(processTasks.get(0).getId()).getFormKey();&lt;BR /&gt;…&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helped&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;R&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Feb 2012 05:49:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101087#M70127</guid>
      <dc:creator>roig</dc:creator>
      <dc:date>2012-02-19T05:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101088#M70128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your reply. Your snippet works well but with a few restrictions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will only work if there is already a task (at runtime) with the appropriate task definition key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But if I deploy a completly new process and run the process for the first time, the task definition key&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;does not exist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that the task is not yet persisted in the database when the taskListener is called.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 13:31:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101088#M70128</guid>
      <dc:creator>ovonel</dc:creator>
      <dc:date>2012-02-21T13:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101089#M70129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post your solution? 10x&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 05:47:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101089#M70129</guid>
      <dc:creator>roig</dc:creator>
      <dc:date>2012-02-23T05:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101090#M70130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I dont have a really solution. I just need the names of the form variables (this data is placed only in the deployed xml file),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from several tasks. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My workaround is to hardcode the form variables in my code. The big disadvantage is that I have to&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;adjust it every time I change the variables in the bpmn-model. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have a better solution, please let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;best regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 10:36:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101090#M70130</guid>
      <dc:creator>ovonel</dc:creator>
      <dc:date>2012-02-24T10:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: TaskListener FormProperties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101091#M70131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I checked with the source code and found that a TaskFormData must be generated along with an execution, i.e a process instance, to fill in those expressions in FormProperty. I guess, the problem is, in create event stage, that task is not commit yet and nowhere to be found by taskId. And roig's workaround is a bit risky such that it's only workable when there's at least one waiting task of other process instances, which is a too strict condition.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I think there's only two ways to go&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Get TaskFormData after the task is created, maybe in your own task handler. But this my not suit your requirement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Here comes a ugly but really useful codes to obtain definition infos. It's for test only but all necessary info is included:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt; @Test&lt;BR /&gt; @Transactional("bpmTxManager")&lt;BR /&gt; public void testSetAssignees() throws IOException {&lt;BR /&gt;&amp;nbsp; RepositoryServiceImpl repo = (RepositoryServiceImpl) processEngine&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getRepositoryService();&lt;BR /&gt;&amp;nbsp; ProcessDefinitionEntity pde = (ProcessDefinitionEntity) repositoryService&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .createProcessDefinitionQuery()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .processDefinitionKey("Mco_ApproveProcessExample")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .latestVersion().singleResult();&lt;BR /&gt;&amp;nbsp; pde = (ProcessDefinitionEntity) repo.getDeployedProcessDefinition(pde&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getId());&lt;BR /&gt;&amp;nbsp; Properties prop = new Properties();&lt;BR /&gt;&amp;nbsp; prop.load(new StringReader(pde.getDescription()));&lt;BR /&gt;&amp;nbsp; System.out.println(prop.getProperty("context"));&lt;BR /&gt;&amp;nbsp; System.out.println(prop.getProperty("desc"));&lt;BR /&gt;&amp;nbsp; System.out.println("process: " + pde.getDescription());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; Map&amp;lt;String,TaskDefinition&amp;gt; tasks = pde.getTaskDefinitions();&lt;BR /&gt;&amp;nbsp; for(Iterator&amp;lt;Map.Entry&amp;lt;String, TaskDefinition&amp;gt;&amp;gt; iter = tasks.entrySet().iterator();iter.hasNext():smileywink:{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Entry&amp;lt;String, TaskDefinition&amp;gt; entry = iter.next();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; System.out.println("key: " + entry.getKey());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TaskDefinition task = entry.getValue();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; System.out.println("task key: " + task.getKey());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; System.out.println("task name: " + task.getNameExpression().getExpressionText());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; System.out.println("assignee: " + task.getAssigneeExpression().getExpressionText());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; List&amp;lt;FormPropertyHandler&amp;gt; handlers = ((DefaultTaskFormHandler) task&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getTaskFormHandler()).getFormPropertyHandlers();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; for(FormPropertyHandler handler : handlers){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("form property name:" + handler.getName()); // here is what you want i guess&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt; }&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;These codes depends on implementation so may be outdated in the future. I tested it on 5.6 and 5.8.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Feb 2012 09:34:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/tasklistener-formproperties/m-p/101091#M70131</guid>
      <dc:creator>sherlockq</dc:creator>
      <dc:date>2012-02-29T09:34:31Z</dc:date>
    </item>
  </channel>
</rss>

