<?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 AlfrescoAssignment and email notifications in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/alfrescoassignment-and-email-notifications/m-p/292026#M245156</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have written a custom JBPM workflow that for some tasks has to send notifications to the assigned users.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know how to do it using a custom java action or a simple javascript, but I am trying to use the flag bpm_sendEMailNotifications: if this flag is true, the class org.alfresco.repo.workflow.jbpm.AlfrescoAssignment automatically sends the notifications.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example the following task in the workflow definition sets the flag to true on the creation of the task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;task-node name="finalReview"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;task name="mswf:reviewTask"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;pooledactors&amp;gt;#{finalReviewReviewer}&amp;lt;/pooledactors&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/assignment&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;event type="task-create"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; executionContext.setVariable("bpm_sendEMailNotifications", true);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/event&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/task&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;transition name="approve" to="endFinalReview"/&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;transition name="reject" to="endFinalReview"/&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/task-node&amp;gt;&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;/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;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;The transition to this node fails with the following exception:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"07052361 Accessing task with id='jbpm$200957' is not allowed for user 'atc1'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;atc1 is the user that clicks the transition button and it is not the current user assigned to the task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The exception is thrown by the class WorkflowNotificationUtils when it tries to get the WorkflowTask (at line 168 for Alfresco enterprise version 4.1.7):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;WorkflowTask workflowTask = services.getWorkflowService().getTaskById(taskId);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I verified that the task has been already assigned to a different user, as expected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Aug 2014 18:11:36 GMT</pubDate>
    <dc:creator>marco_altieri</dc:creator>
    <dc:date>2014-08-05T18:11:36Z</dc:date>
    <item>
      <title>AlfrescoAssignment and email notifications</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfrescoassignment-and-email-notifications/m-p/292026#M245156</link>
      <description>I have written a custom JBPM workflow that for some tasks has to send notifications to the assigned users.I know how to do it using a custom java action or a simple javascript, but I am trying to use the flag bpm_sendEMailNotifications: if this flag is true, the class org.alfresco.repo.workflow.jbpm</description>
      <pubDate>Tue, 05 Aug 2014 18:11:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfrescoassignment-and-email-notifications/m-p/292026#M245156</guid>
      <dc:creator>marco_altieri</dc:creator>
      <dc:date>2014-08-05T18:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: AlfrescoAssignment and email notifications</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfrescoassignment-and-email-notifications/m-p/292027#M245157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is not possible to replicate the issue with the vanilla workflows because the assignment to the reviewers is executed when the workflow starts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, the user that sends the notifications is necessarily the user that started the workflow and so there is no problem with permissions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my workflow, the review process starts only after the completion of other tasks and the user that activates it is not the same user that started the workflow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;To solve the problem I have modified the AlfrescoAssignment class executing the code to send the notifications as system. I do not think that this will create any security issues if users do not have access to the email notifiication templates and the javascript console.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 10:19:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfrescoassignment-and-email-notifications/m-p/292027#M245157</guid>
      <dc:creator>marco_altieri</dc:creator>
      <dc:date>2014-08-06T10:19:21Z</dc:date>
    </item>
  </channel>
</rss>

