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.
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.........
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.
All of those tables show empty in mine. I have synced these users and groups from keycloak. Does that make any difference?
Yes, I can get an Id if I am in TaskListener. but I am looking for something which I can use outside the TaskListener.
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?
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>
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.