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

dhananjay
Giga Contributor

Hi jack,

CAn you please tell me how are you trying to send Worknotes to the approver again from task.

 

I think you should handel it through an runscript activity in WF after the catalog task and try to set the worknotes from there.

Hello dhananjay@21,

thanks for your reply.

I get the Comments from the approval as described in the reference link of step 2, respectively as posted by bhagya1764 above.

How to send the Work Notes from the Task to the Approver, is described in the reference link of step 3.
My problem is however, to get the Work Notes from the Task in the first place.

Any ideas?

dhananjay
Giga Contributor

 

 

 

Add a Runscript after Task 

Seems to work ok if I branch before creating approvals and in the branch wait 15 seconds (presumably while approvals are created) then glide update the records . (refer the picture below)

Adding this code in Runscript and modify it according to your requirement

 

function addTexttoApprovals(){

var apprv = new GlideRecord("sysapproval_approver");
apprv.addQuery("sysapproval", "=", current.sys_id);
apprv.addQuery("state", "=", 'requested');
apprv.query();
while (apprv.next()) {
apprv.comments='This approval reflects whether testing results warrant moving forward to production. \nApprove and this will move forward to Production. \nReject and it will be sent back for re-development to address any issues. ';
apprv.update();
//current.work_notes=("Updating related Approval " + apprv.sys_id+'.\n');
}
}
addTexttoApprovals();


dhananjay@21,

thanks again for replying, your effort is very much appreciated.
But please take a minute and read my initial question and the answer to your first reply completely.

Quote:
"...
My problem is however, to get the Work Notes from the Task in the first place.
..."

Any ideas?

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?