How to get task ID and Process Instance ID from a custom stencil.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner

How to get task ID and Process Instance ID from a custom stencil.

Jump to solution

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.  

1 Solution

Accepted Solutions
Highlighted
Partner

Re: How to get task ID and Process Instance ID from a custom stencil.

Jump 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)

 

View solution in original post

1 Reply
Highlighted
Partner

Re: How to get task ID and Process Instance ID from a custom stencil.

Jump 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)

 

View solution in original post