<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get task ID and Process Instance ID from a custom stencil. in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-task-id-and-process-instance-id-from-a-custom-stencil/m-p/41938#M17583</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;First, get task ID from the scope ($scope.taskId).&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third, call CommenService.getProcessInstanceComments(processId) to get all the comments that belong to the process instacnce.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To save (create) a new comment, call CommentService.createProcessInstanceComment(processInstanceId, commentStr) or CommentService.createTaskComment(taskId, commentStr)&lt;/P&gt;</description>
    <pubDate>Sat, 29 Aug 2020 03:14:28 GMT</pubDate>
    <dc:creator>wonsim</dc:creator>
    <dc:date>2020-08-29T03:14:28Z</dc:date>
    <item>
      <title>How to get task ID and Process Instance ID from a custom stencil.</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-task-id-and-process-instance-id-from-a-custom-stencil/m-p/41937#M17582</link>
      <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone can tell how to get the task ID and process instance ID from the javascript?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 20:01:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-task-id-and-process-instance-id-from-a-custom-stencil/m-p/41937#M17582</guid>
      <dc:creator>wonsim</dc:creator>
      <dc:date>2020-08-28T20:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get task ID and Process Instance ID from a custom stencil.</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-task-id-and-process-instance-id-from-a-custom-stencil/m-p/41938#M17583</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;First, get task ID from the scope ($scope.taskId).&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third, call CommenService.getProcessInstanceComments(processId) to get all the comments that belong to the process instacnce.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To save (create) a new comment, call CommentService.createProcessInstanceComment(processInstanceId, commentStr) or CommentService.createTaskComment(taskId, commentStr)&lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2020 03:14:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-task-id-and-process-instance-id-from-a-custom-stencil/m-p/41938#M17583</guid>
      <dc:creator>wonsim</dc:creator>
      <dc:date>2020-08-29T03:14:28Z</dc:date>
    </item>
  </channel>
</rss>

