Copy Worknotes from RITM to Request

Samiksha2
Mega Sage

Hi All,

 

I need to copy RITM work notes for a particular catalog item.

I am not sure what to add in the query.

Please help.

Thanks,

Sam

2 ACCEPTED SOLUTIONS

Harish KM
Kilo Patron
Kilo Patron

Hi @Samiksha2 Create a after update BR

cond: item is "your catalog"

script:

var workNotes = current.work_notes.getJournalEntry(1);
var app = new GlideRecord('sc_request');
app.addQuery('sys_id', current.request);
app.query();
if(app.next()){
app.work_notes = "workNotes Updated " +workNotes;
app.update();
}
Regards
Harish

View solution in original post

Hi @Samiksha2 the below cond works for me,

HarishKM_0-1707367843422.png

 

Regards
Harish

View solution in original post

14 REPLIES 14

Hi @Samiksha2 the below cond works for me,

HarishKM_0-1707367843422.png

 

Regards
Harish

Unique45
Mega Sage

Hello @Samiksha2,

You need to create after business rules on RITM table.

Please refer below screenshots:

Unique45_0-1707297970398.png

Unique45_1-1707297999054.png

(function executeRule(current, previous /*null when async*/) {
	var request = new GlideRecord("sc_request");
	request.addQuery("sys_id", current.request);
	request.query();
	if (request.next()) {
		request.work_notes = current.work_notes.getJournalEntry(1);
		request.update();
		}
})(current, previous);

 

Please mark correct/helpful if this helps you!

Samiksha2
Mega Sage

Thank you everyone for the reply.

But can anyone help me with this query- when worknote is not updated by system then only it should copied.

I guess this will work

grs.addEncodedQuery('sys_updated_by!=system');
 
Thanks,
Sam

No It is not working