Synchronize catalog task activity and requested item activity

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:05 AM
Hi, how do we synchronize the catalog task activity and requested item activity.
I have successfully synchronize them both using BR for catalog task and BR for Requested Item.
The when to run of my BR's are:
When: before
Update
The problem is, the activity in the catalog task are duplicated.
See the screenshots below:
I know that the one causing the duplication is because of the 2 Business rule running. In which the Requested Item BR will be triggered
when the Catalog Task added a work notes.
I also tried adding
if(!current.work_notes.getJournalEntry(-1).split("\n\n")[0].indexOf('Work notes')){
gr.comments = comments;
gr.update();
}
It stops the duplication of the catalog task activity.
But the comments from requested item to catalog task. doesn't work anymore.
Thanks,
Tadz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:07 AM
Hi Tadz,
Remove the current.update() from the before business rule, This should work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:12 AM
Hi Ketan,
I have no current.update() in my script.
Only gr.update(); since I am using a gliderecord.
Thanks,
Tadz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:33 AM
Ohh I See
Can you paste full BR here ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:36 AM
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
var comments = current.comments;
var sys_id = current.sys_id;
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item','=',sys_id);
gr.query();
if(gr.next())
{
if(!current.comments.getJournalEntry(-1).split("\n\n")[0].indexOf('Work notes')){
gr.comments = comments;
gr.update();
}
}
}