work notes duplicating when copying between task and item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 01:19 AM
Hi,
I have a requirement to have comments and work notes copied from items to task and vice-versa, so I have created 2 business rules to do this (as below) - the issue is that i get duplicate entires (eg a work note added to the item is copied to the task, but then as the work notes on teh task have changed this is then copied back to the item again)
Is there a better way of doing this which will avoid the duplication?
( i have tried adding the request item comments and work notes to the task form, but there does not seem to be the option to go the other way, and this still contains duplications)
thanks in advance
- before update on sc_req_item (when add comm/wn change)
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.query();
while(gr.next()){
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
}
- before update on sc_task (when wn change)
var gr = new GlideRecord('sc_req_item');
gr.get(current.request_item);
gr.work_notes = current.work_notes;
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 02:57 AM
Hi Chris,
Make both these Business rules as after with a large order value...order =900
- after update on sc_req_item (when add comm/wn change)
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.setWorkflow('false');
gr.query();
while(gr.next()){
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
}
- after update on sc_task (when wn change)
var gr = new GlideRecord('sc_req_item');
gr.setWorkflow('false');
gr.get(current.request_item);
gr.work_notes = current.work_notes;
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 03:15 AM
try to use gr.setWorkflow(false); before gr.update(); statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 03:28 AM
i suggested that only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 06:20 AM
thanks for the suggestions
gr.setWorkflow('false'); doesn't seem to make any difference
setting to after 900 stops it copying it over at all