Copy Worknotes from one task to another

Tadz
Tera Guru
Tera Guru

Hi Everyone,

I have this requirement where I have two catalog task in which when 1 task updated their worknotes it should reflect to the other task.

The issue is, since they are on the same table sc_task. Whenever i tried to do a gliderecord and update it will reflect back to the current updated record. Causing it to be duplicated.

My Approach is an On Before Business Rule.

with the following script:

var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.request_item);
gr.addQuery("number", "!=", current.number);
gr.query();
if (gr.next()) {
gr.work_notes = current.work_notes;
gr.update();
}

 

Is there a way to update without causing the current record to be updated again? I already tried setworkflow(false) but its not working.

 

Thanks in advance! 

Tadz

14 REPLIES 14

current.work_notes.getJournalEntry(1);

 

Also make sure you use while instead of if block. because while will get all the task

Harsh Vardhan
Giga Patron

let me know if you need any further help here.

if i answered your query, mark my answer correct and close this thread.

GChanner
Tera Guru

Hi Guy's

I need a little help modifying the referenced code above in a 'after BR'. I would like the work notes of task 1 to be passed to Task 2 only after task 1 is closed.

 

As Harshvardhan mentioned, you need to add one more condition to the business rule

Note: use After Business rule and set the condition : worknotes changes + task state is closed completed


SNOWBeginner1
Giga Expert

Any solution to this