<?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 Assigning task to users group based on condition in enterprise Activiti in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17843#M7913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tree users group and want to assign task to the users group based on complexity value.These are my group users:&lt;/P&gt;&lt;P&gt;1-expert_users&lt;/P&gt;&lt;P&gt;2-senior_users&lt;/P&gt;&lt;P&gt;3-junior_users&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1-If&amp;nbsp;&lt;SPAN&gt;complexity&amp;nbsp;value is "High" then the task must be assigned to&amp;nbsp;expert_users group&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2-If&amp;nbsp;&lt;SPAN&gt;complexity&amp;nbsp;value is "Medium" then the task must be assigned to senior_users group&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;3-If&amp;nbsp;&lt;SPAN&gt;complexity&amp;nbsp;value is "Low" then the task must be assigned to&lt;SPAN&gt; &lt;SPAN&gt;junior_users&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;group&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;I have created task listener as follow:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16097_pastedImage_1.png" style="width: 620px; height: 396px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;And I have used expression &amp;nbsp;as follow:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;IMG class="image-2 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16098_pastedImage_2.png" style="width: 620px; height: 356px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;I have set an variable as global scope as follow:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;IMG class="jive-image image-4" src="https://connect.hyland.com/legacyfs/online/alfresco/16100_pastedImage_4.png" style="width: 620px; height: 514px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;After done above implementation, I am getting below error:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;IMG class="image-3 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16099_pastedImage_3.png" style="width: 620px; height: 285px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Please let me know what I am doing&amp;nbsp;wrong here.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Sep 2017 10:53:07 GMT</pubDate>
    <dc:creator>rahiakela</dc:creator>
    <dc:date>2017-09-11T10:53:07Z</dc:date>
    <item>
      <title>Assigning task to users group based on condition in enterprise Activiti</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17843#M7913</link>
      <description>I have tree users group and want to assign task to the users group based on complexity value.These are my group users:1-expert_users2-senior_users3-junior_users1-If&amp;nbsp;complexity&amp;nbsp;value is "High" then the task must be assigned to&amp;nbsp;expert_users group2-If&amp;nbsp;complexity&amp;nbsp;value is "Medium" then the task must be</description>
      <pubDate>Mon, 11 Sep 2017 10:53:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17843#M7913</guid>
      <dc:creator>rahiakela</dc:creator>
      <dc:date>2017-09-11T10:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning task to users group based on condition in enterprise Activiti</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17844#M7914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;After I have modified task listener implementation, t&lt;/SPAN&gt;he error has gone but dynamic group assignment still not working.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16130_pastedImage_1.png" style="width: 620px; height: 374px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2017 08:47:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17844#M7914</guid>
      <dc:creator>rahiakela</dc:creator>
      <dc:date>2017-09-14T08:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning task to users group based on condition in enterprise Activiti</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17845#M7915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is done by using this following implementation:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16537_pastedImage_1.png" style="width: 620px; height: 447px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 05:26:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17845#M7915</guid>
      <dc:creator>rahiakela</dc:creator>
      <dc:date>2017-09-27T05:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning task to users group based on condition in enterprise Activiti</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17846#M7916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The GroupService is part of which library? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 01:45:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17846#M7916</guid>
      <dc:creator>sachin_sahlot</dc:creator>
      <dc:date>2019-03-04T01:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning task to users group based on condition in enterprise Activiti</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17847#M7917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the attached app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can write your task listener as like below, hope it solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;package com.activiti.extension.bean;&lt;/P&gt;&lt;P&gt;import org.activiti.engine.delegate.DelegateExecution;&lt;BR /&gt;import org.activiti.engine.delegate.DelegateTask;&lt;BR /&gt;import org.activiti.engine.delegate.TaskListener;&lt;BR /&gt;import org.activiti.engine.impl.util.json.JSONArray;&lt;BR /&gt;import org.activiti.engine.impl.util.json.JSONObject;&lt;BR /&gt;import org.springframework.http.HttpEntity;&lt;BR /&gt;import org.springframework.http.HttpMethod;&lt;BR /&gt;import org.springframework.http.MediaType;&lt;BR /&gt;import org.springframework.http.ResponseEntity;&lt;BR /&gt;import org.springframework.util.LinkedMultiValueMap;&lt;BR /&gt;import org.springframework.util.MultiValueMap;&lt;BR /&gt;import org.springframework.web.client.RestTemplate;&lt;/P&gt;&lt;P&gt;import sun.misc.BASE64Encoder;&lt;/P&gt;&lt;P&gt;public class test implements TaskListener {&lt;BR /&gt; RestTemplate restTemplate = new RestTemplate();&lt;BR /&gt; String url = "http://localhost:8082/activiti-app";&lt;/P&gt;&lt;P&gt;@Override&lt;BR /&gt; public void notify(DelegateTask task) {&lt;BR /&gt; // TODO Auto-generated method stub&lt;BR /&gt; DelegateExecution execution = task.getExecution();&lt;BR /&gt; String cmplx=(String) execution.getVariable("complexity");&lt;BR /&gt; System.out.println("complexity="+cmplx);&lt;BR /&gt; String groupName="";&lt;BR /&gt; String groupId="";&lt;BR /&gt; HttpEntity&amp;lt;String&amp;gt; requestEntity = new HttpEntity&amp;lt;String&amp;gt;("", getHeadersForAPS());&lt;BR /&gt; if(cmplx.toLowerCase().equals("high")) {&lt;BR /&gt; groupName="high";&lt;BR /&gt; ResponseEntity&amp;lt;String&amp;gt; groupData = restTemplate.exchange(url+"/api/enterprise/groups?filter="+groupName, HttpMethod.GET, requestEntity, String.class);&lt;BR /&gt; System.out.println("groupData="+groupData.getBody());&lt;BR /&gt; JSONObject getSubGroupDataJson = new JSONObject(groupData.getBody());&lt;BR /&gt; JSONArray dataArray= getSubGroupDataJson.getJSONArray("data");&lt;BR /&gt; groupId = dataArray.getJSONObject(0).getString("id");&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; }&lt;BR /&gt; else if(cmplx.toLowerCase().equals("medium")) {&lt;BR /&gt; groupName="medium";&lt;BR /&gt; ResponseEntity&amp;lt;String&amp;gt; groupData = restTemplate.exchange(url+"/api/enterprise/groups?filter="+groupName, HttpMethod.GET, requestEntity, String.class);&lt;BR /&gt; System.out.println("groupData="+groupData.getBody());&lt;BR /&gt; JSONObject getSubGroupDataJson = new JSONObject(groupData.getBody());&lt;BR /&gt; JSONArray dataArray= getSubGroupDataJson.getJSONArray("data");&lt;BR /&gt; groupId = dataArray.getJSONObject(0).getString("id");&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; groupName="low";&lt;BR /&gt; ResponseEntity&amp;lt;String&amp;gt; groupData = restTemplate.exchange(url+"/api/enterprise/groups?filter="+groupName, HttpMethod.GET, requestEntity, String.class);&lt;BR /&gt; System.out.println("groupData="+groupData.getBody());&lt;BR /&gt; JSONObject getSubGroupDataJson = new JSONObject(groupData.getBody());&lt;BR /&gt; JSONArray dataArray= getSubGroupDataJson.getJSONArray("data");&lt;BR /&gt; groupId = dataArray.getJSONObject(0).getString("id");&lt;BR /&gt; }&lt;BR /&gt; System.out.println("groupId="+groupId);&lt;BR /&gt; task.addCandidateGroup(groupId); &lt;BR /&gt; System.out.println("ggg="+task.getCandidates());&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; public MultiValueMap&amp;lt;String, String&amp;gt; getHeadersForAPS()&lt;BR /&gt; {&lt;BR /&gt; String alfrescoUserName = "admin@app.activiti.com";&lt;BR /&gt; String alfrescoPassword = "admin";&lt;BR /&gt; String authString = alfrescoUserName + ":" + alfrescoPassword;&lt;BR /&gt; String authStringEnc = new BASE64Encoder().encode(authString.getBytes());&lt;BR /&gt; MultiValueMap&amp;lt;String, String&amp;gt; headers = new LinkedMultiValueMap&amp;lt;String, String&amp;gt;();&lt;BR /&gt; headers.add("Accept", "application/json");&lt;BR /&gt; headers.add("Content-Type", MediaType.APPLICATION_JSON.toString());&lt;BR /&gt; headers.add("Authorization", "Basic " + authStringEnc);&lt;BR /&gt; return headers;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amruta Wandakar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2019 06:01:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/assigning-task-to-users-group-based-on-condition-in-enterprise/m-p/17847#M7917</guid>
      <dc:creator>amruta_w</dc:creator>
      <dc:date>2019-03-07T06:01:52Z</dc:date>
    </item>
  </channel>
</rss>

