10-29-2018 08:44 AM
I am using activiti enterprise and I have synced all groups and users from Keycloak to activiti.. Using the process service editor I have set candidate group for a user task as follows:
I have a complete Task method which I am trying to check if the user belongs to the candidate group. I have had a look at the following link
What is the best way to find out the candidate group a task?
and tried taskService.getIdentityLinksForTask(taskId)
method and it did not return anything.
What would be the best way to get the candidate group for a task programmatically.
10-30-2018 01:36 AM
Hi,
If you are using Tasklistner (DelegateTask task) then you can fetch all the candidate groups using
task.getCandidates() which returns Hashset<IdentityLink>. then you can get the id by looing through it.
Hope it helps.........
10-31-2018 02:07 AM
Yes, I can get an Id if I am in TaskListener. but I am looking for something which I can use outside the TaskListener.
10-31-2018 01:27 AM
In the Activiti API, taskService.getIdentityLinksForTask(taskId) will return the IdentityLinks associated with the given task.
This can do that!
As for you did not return anything, you should check one thing :
In Activiti's tables, the data that exist in act_id_user and act_id_group must be associated by act_id_membership. Only in this way, the method can return data. Studying these tables is very important.
10-31-2018 02:05 AM
All of those tables show empty in mine. I have synced these users and groups from keycloak. Does that make any difference?
10-31-2018 04:12 AM
Oh, the method of Activiti API can only handle the data of 23 tables which generated by Activiti.
If your users and groups don't exist in Activiti's tables, you should write method by yourself.
Could you show your diagram or xml code?
10-31-2018 07:34 AM
I have data in my GROUPS and USERS tables though.
Hi below is the xml code for the User Task:
<userTask id="sid-7D3D5EEF-F684-4A61-949C-EE40A3DA0F2D" name="Confirm" activiti:candidateGroups="1012" activiti:formKey="22">
<extensionElements>
<activiti:taskListener event="create" class="com.abc.tasks.listener.MyListener"/>
<modeler:allow-send-email><![CDATA[false]]></modeler:allow-send-email>
<modeler:form-reference-id><![CDATA[22]]></modeler:form-reference-id>
<modeler:form-reference-name><![CDATA[Sys1 - Confirm]]></modeler:form-reference-name>
<modeler:group-info-name-1012><![CDATA[ABC_ONE]]></modeler:group-info-name-1012>
<modeler:group-info-externalid-1012><![CDATA[ABC_ONE]]></modeler:group-info-externalid-1012>
<modeler:activiti-idm-candidate-group><![CDATA[true]]></modeler:activiti-idm-candidate-group>
<modeler:initiator-can-complete><![CDATA[false]]></modeler:initiator-can-complete>
<modeler:editor-resource-id><![CDATA[sid-7D3D5EEF-F684-4A61-949C-EE40A3DA0F2D]]></modeler:editor-resource-id>
</extensionElements>
</userTask>
Explore our Alfresco products with the links below. Use labels to filter content by product module.