Hi all, I am creating a custom stencil in APS, and I need to get the user comments for the process instance (and task). I think I can get it using the predefined TaskSerivce and ProcessService services.
In order to call the functions in the services to get the comments, I need to pass the task ID and process intance ID to these functions, and I am having difficult time getting this information in the anguar code.
Does anyone can tell how to get the task ID and process instance ID from the javascript?
Thank you in advance.
Solved! Go to Solution.
I just figured out how to get the task ID in a custom form field stencil. Here is what I did. Hope this helps others in the future as I spend so much time to figure this out.
It turned out it is very simple. Just took a long time to figure this out as I could not find any documents around this.
First, get task ID from the scope ($scope.taskId).
Seond, get the process instance ID by calling TaskService.getTask(taskId). It returns the details of the task and it contains the process instance ID.
Third, call CommenService.getProcessInstanceComments(processId) to get all the comments that belong to the process instacnce.
To save (create) a new comment, call CommentService.createProcessInstanceComment(processInstanceId, commentStr) or CommentService.createTaskComment(taskId, commentStr)
I just figured out how to get the task ID in a custom form field stencil. Here is what I did. Hope this helps others in the future as I spend so much time to figure this out.
It turned out it is very simple. Just took a long time to figure this out as I could not find any documents around this.
First, get task ID from the scope ($scope.taskId).
Seond, get the process instance ID by calling TaskService.getTask(taskId). It returns the details of the task and it contains the process instance ID.
Third, call CommenService.getProcessInstanceComments(processId) to get all the comments that belong to the process instacnce.
To save (create) a new comment, call CommentService.createProcessInstanceComment(processInstanceId, commentStr) or CommentService.createTaskComment(taskId, commentStr)
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.