<?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: Dynamically assign a list of users as candidate assignees in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/dynamically-assign-a-list-of-users-as-candidate-assignees/m-p/216480#M169610</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For Enterprise Edition, I use the following script task (groovy) code snippet in BP3's Activiti Basic training to demonstrate this exact scenario.&lt;/P&gt;&lt;P&gt;The example uses the userService to get all users and iterate over the result, but you can use the same technique on a comma separated list passed into the process:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import com.activiti.domain.idm.User;&lt;BR /&gt;import com.activiti.security.SecurityUtils;&lt;/P&gt;&lt;P&gt;out.println('Start - Init');&lt;BR /&gt;User currentUser = SecurityUtils.getCurrentUserObject();&lt;BR /&gt;ArrayList idList = new ArrayList(); &lt;BR /&gt;Long tenantId = currentUser.getTenantId();&lt;/P&gt;&lt;P&gt;List&amp;lt;User&amp;gt; users = userService.getAllUsers(0,999,tenantId);&lt;BR /&gt;for (User u : users) {&lt;BR /&gt; idList.add(String.valueOf(u.getId()));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;execution.setVariable('assigneeList', idList);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;out.println('End - Init');&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Once you have a list of user ids assig&lt;SPAN&gt;ned to a process instance variable, simply set the candidate users to reference the list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/11866_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;If you are using Community Edition, the approach is exactly the same but instead of using userService you would use identityService.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;BR /&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jan 2017 20:02:09 GMT</pubDate>
    <dc:creator>gdharley</dc:creator>
    <dc:date>2017-01-03T20:02:09Z</dc:date>
    <item>
      <title>Dynamically assign a list of users as candidate assignees</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/dynamically-assign-a-list-of-users-as-candidate-assignees/m-p/216479#M169609</link>
      <description>How can I set a list users (e.g. in a comma delimited string) as candidate assignees? I am passing the list to the start form with the process-instance API and attempting to use an expression in the candidate property on the user task.</description>
      <pubDate>Wed, 28 Dec 2016 20:24:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/dynamically-assign-a-list-of-users-as-candidate-assignees/m-p/216479#M169609</guid>
      <dc:creator>leealt</dc:creator>
      <dc:date>2016-12-28T20:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically assign a list of users as candidate assignees</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/dynamically-assign-a-list-of-users-as-candidate-assignees/m-p/216480#M169610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For Enterprise Edition, I use the following script task (groovy) code snippet in BP3's Activiti Basic training to demonstrate this exact scenario.&lt;/P&gt;&lt;P&gt;The example uses the userService to get all users and iterate over the result, but you can use the same technique on a comma separated list passed into the process:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import com.activiti.domain.idm.User;&lt;BR /&gt;import com.activiti.security.SecurityUtils;&lt;/P&gt;&lt;P&gt;out.println('Start - Init');&lt;BR /&gt;User currentUser = SecurityUtils.getCurrentUserObject();&lt;BR /&gt;ArrayList idList = new ArrayList(); &lt;BR /&gt;Long tenantId = currentUser.getTenantId();&lt;/P&gt;&lt;P&gt;List&amp;lt;User&amp;gt; users = userService.getAllUsers(0,999,tenantId);&lt;BR /&gt;for (User u : users) {&lt;BR /&gt; idList.add(String.valueOf(u.getId()));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;execution.setVariable('assigneeList', idList);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;out.println('End - Init');&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Once you have a list of user ids assig&lt;SPAN&gt;ned to a process instance variable, simply set the candidate users to reference the list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/11866_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;If you are using Community Edition, the approach is exactly the same but instead of using userService you would use identityService.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;BR /&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 20:02:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/dynamically-assign-a-list-of-users-as-candidate-assignees/m-p/216480#M169610</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-01-03T20:02:09Z</dc:date>
    </item>
  </channel>
</rss>

