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 06:23 AM
can you give it another shot with
gr.setWorkflow(false);
instead of
gr.setWorkflow('false');
//passing Boolean instead of string in the function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2015 07:02 AM
no change unfortunately
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2015 05:21 PM
Hi Anurag,
I need help with this as well. I want to copy comments from task to requested item and from requested item to other catalogue tasks in the workflow.
It is before BR and also tried using gr.setWorkflow(false);. This copies comments from task to requested item but stops copying to other tasks.
Thanks,
Hema
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 12:46 AM
are you using different BR's to copy the worknotes ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 02:55 PM
Hi Anurag,
Yes I am using different business rules.
One to copy comments from Task to requested item and other rule to copy from requested item to task.
Pass comments to Requested item
Before BR on update
addCommentToReqItem();
function addCommentToReqItem()
{
if (current.sys_id == '')
return;
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.request_item.sys_id);
gr.query();
while (gr.next()) {
gr.comments = current.comments;
//gr.setWorkflow(false);
gr.update();
}
}
Pass comments to Task
addCommentToTasks();
function addCommentToTasks() {
if (current.sys_id == '')
return;
var gr = new GlideRecord('sc_task');
gr.addQuery('parent', current.sys_id);
gr.query();
while (gr.next()) {
gr.comments = current.comments;
//gr.setWorkflow(false);
gr.update();
}
}
Thanks,
Hema