Sharing Comments between Request, Request Items, and Catalog Tasks

Brian Treichel
Tera Guru

Hello, We are trying to share all of the comments between all of the Request, Request Items, and Catalog Tasks, but keep running into issues. Here are the circumstances we are trying to cover:

Comment Added to Request: Add Comment to all RITMs and TASKs

Comment Added to RITM: Add Comment to REQ and all of the TASKs for the RITM

Comment Added to TASK: Add comment to the REQ and the TASK's RITM

We have created 3 Business Rules for each of these circumstances, however, they are triggering each other.

The first thing I tried doing was adding setWorkflow(false) to all of the GlideRecord updates, but this looks like it's hindering the submission of the comment into the activity log. Basically, it looks like the comments are being committed at all.

Here is a simple example of just the RITM and REQ comment sharing:

Table: Request

When: After - Insert or Update

Filter: Additional Comments changes

var ritm = new GlideRecord('sc_req_item');

ritm.addQuery('request',current.getUniqueValue());

ritm.query();

while(ritm.next()){

  ritm.comments = 'Comment added on Request: ' + current.comments;

  ritm.setWorkflow(false);

  ritm.update();

}

Table: Request Item

When: After - Insert or Update

Filter: Additional Comments changes

var req = new GlideRecord('sc_request');

if(req.get(current.request.sys_id)){

  req.comments = 'Comment added on Request Item: ' + current.comments;

  req.setWorkflow(false);

  req.update();

}

Thanks!

5 REPLIES 5

gtk
Mega Sage

Brian Treichel,



follow this thread, it might be helpful to you.




copying worknotes and comments from child to parent.





Developer Community