08-28-2020 04:01 PM
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.
08-28-2020 11:14 PM
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)
08-28-2020 11:14 PM
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)
Explore our Alfresco products with the links below. Use labels to filter content by product module.