Catalog Task and Requested Item, Activity comments

Tadz
Tera Guru
Tera Guru

Hi, I have a catalog task from a requested item.

And when the fulfiller will add a worknote or comment in the catalog task.

It should show in the requested item. (My initial solution for that is a client script that glide records to the requtested item).

But when the requestor adds a comment in the requested item.

It should show in the catalog task. (My solution here is to make a client script and a gliderecord but it does not work).

Is there a better way for a requestor and fulfiller to communicate through the activity comments?

Thanks,

Tadz

3 REPLIES 3

Mihir Mohanta
Kilo Sage

Hi Cris,



If you update Comments/Work notes from request_item to sc_task and vice-versa then it will go on a loop.


Please don't do this.


You can do it in one way.


Either you update Comments/Work notes from request_item to sc_task or update Comments/Work notes from request_item to sc_task using business rule.


A RITM may contains several tasks. Why you want all task Comments/Work notes to RITM form?





Please mark correct/Helpful if it helps.



Thanks,


Mihir


Hi Mihir,



I would like for fulfiller(catalog_task) and requestor(requested item) to communicate to each other.
In case fulfiller ask for more information.





Thanks,



Tadz


Hello Chris,





What you are looking for is possible.
You need to create two Business Rules. Yet, if you do not add prefix in the scripts of these Business Rules - then you will have a lot of problems, as a loop will be created, as Mihir said.



I had a similar scenario but the goal was to send comments from sc_task to sc_request & vice versa. In order to deal with the loop issue I needed to add prefixes in the scripts of both the Business Rules I wrote.
I will give you an example of the scripts I used and will modify them for your scenario, covering the part with the comments. Please check the below details:




1. Business Rule which moves the comments from Request Item (sc_req_item) to Catalog Task (sc_task):
Name: add such;


Table: Requested Item (sc_req_item);
Application Global;


Active: checked;
Advanced: checked;
When to run: before Update;
Advanced > Condition: current.comments.changes()
Script:



(function executeRule(current, previous /*null when async*/) {



  // This Business Rule ensures that whenever any comments are being added into a Requested Item record (Requested Item (sc_req_item)) -> the comments will be visible (automatically added) into a Catalog Task record (Catalog Task (sc_task));


  var gr = new GlideRecord('sc_task');


  gr.addQuery('request_item',current.sys_id);


  gr.query();


  while(gr.next()){


  gr.comments = '### Customer reply: ' +current.comments;


  gr.update();


  }


})(current, previous);




2. Business Rule which moves the comments from Catalog Task (sc_task) to Request (sc_request):
Name: add such;


Table: Catalog Task (sc_task);
Application: Global;
Active: checked;
Advanced: checked;
When to run: before Update;
Advanced > Condition: current.comments.changes()
Script:



(function executeRule(current, previous /*null when async*/) {



  // This Business Rule ensures that whenever any comments are being added into a Task record (Catalog Task (sc_task)) -> the comments will be visible (automatically added) into a Requested Item record (Request Item (sc_req_item));



  var gr = new GlideRecord('sc_req_item');


  gr.addQuery('sys_id', current.request_item);


  gr.query();


  while(gr.next()){


  gr.comments = '### Fulfiller reply: ' +current.comments;


  gr.update();


  }



})(current, previous);




NOTE: the comments added in the Requested Item will be visible in the Task as follow:


- a comment added into the Requested Item:


I2.png



And the comments added in the Task will be visible in the Requested Item as follow:


I3.png




Please use the above BRs and make a test in your system. I am sure your scenario will be covered accordingly.




Best Regards,


Georgi Mavrodiev



IT Consultant
Do IT Wise



You may visit us in our Web Site: www.doitwise.com