Displaying Comments and Work Notes in Task and Approval

Jack42
Kilo Expert

Happy Monday everybody,

I'm having difficulties for provide Comments and Work Notes for the users using my workflow.
I seems I'm losing these information somewhere on the way, respectively I'm not able to "find" them anymore.

Scenario:
I have 2 users involved, a Requester and an Approver.

  1. At "Begin" the Requester applies by filling in data in a form from the Service Catalog and sending it to an Approver:find_real_file.png

  2. The Approver receives the approval request, checks the content in the form, and rejects with a comment:find_real_file.png
    The first time the workflow runs through this point, I am able to copy the Comments of the Approver to the Requester by putting this script in the Catalog Task. However the second and all following times the workflow passes this point, the script does not work anymore.
    Q: Does anyone have an idea how to forward/copy/display the Approver's Comments to the Catalog Task after the first cycle?

  3. The Requester gets a Catalog Task assigned to, adjusts the data in the form accordingly, and sends (by closing the task) the application with a Work Note back to the Approver:find_real_file.png
    I found a method to set Comments into the 'Approval - User' request, but I'm unable to get the Requester's Work Notes from the Catalog Task. I simply cannot "find" them.
    Q: Does anyone have an idea where/how to "find" the Requester's Work Notes from the Catalog Task?

Many many thanks in advance and best regards,

Jack

1 ACCEPTED SOLUTION

Jack42
Kilo Expert

Dear all,

thanks a lot for your time.

It seems that's too much at a time, so I split my questions into smaller bits.. and I got help.
Please see the solutions in the following posts:

How to "find" the work_notes of a Catalog Task?
Script does not copy comments on 2nd cycle?
How to "communicate" between 3 active items?

View solution in original post

9 REPLIES 9

Bhagya Lakshmi
Mega Guru

Hi,

In catalog task script you will write like this.

var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.sys_id);
apv.addQuery('comments','!=','') // add this to only find approvals that have comments on them
apv.query();
if(apv.next()) { 

task.comments = apv.comments.getJournalEntry(-1); 

}

Try with this and let me know if you are not getting.

 

Hello bhagya1764,

thanks for your suggestion.

Unfortunately this is exactly the code I am referring to in step 2, which works only for the first cycle. For some reason it does not get the Comments, if the Approver rejects the second time.

You could use a run script to create a catalog task instead of using create task. By doing this it should execute and create a new catalog task each time. 

Set a wait for condition after the run script so it wait for the completion of the task.

Hello palmen,

Thank you for replying.

What you're suggesting, is in fact the method described in the post of the reference link in step 3.
However my problem is not to send strings to the approval, but to get the Work Notes from the Task.