Copy RITM variables to sc_task worknotes

varma2
Mega Sage

Hi All,

 

I have requirment which need  to copy the all RITM varibles to sc_task worknotes.

 

Could you please help on this to achive the requirment.

 

Thanks all,

Varma

1 ACCEPTED SOLUTION

@varma2 Please try below updated code. It will fix the issues.

 

var ritm = new GlideRecord("sc_req_item");
if(ritm.get(current.request_item.toString())){
var itemOption = new GlideRecord("item_option_new");
itemOption.addQuery("cat_item="+ritm.cat_item.toString());
itemOption.addQuery("nameISNOTEMPTY");
itemOption.orderBy("order");
itemOption.query();

var workNotes = "";
while(itemOption.next()){
workNotes += itemOption.question_text.toString() +" : "+ritm.variables[itemOption.name.toString()].getDisplayValue()+"\n";

}

current.work_notes = workNotes;
}
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

24 REPLIES 24

@varma2 can you please post the screen shots of when to run section and advanced section of business rule please 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

HI @jaheerhattiwale ,

 

Please refer the attachment.

 

Thanks

@varma2 I have updated the code. Please try. This should work.

 

var ritm = new GlideRecord("sc_req_item");
if(ritm.get(current.request_item.toString())){
var itemOption = new GlideRecord("item_option_new");
itemOption.addQuery("cat_item="+ritm.cat_item.toString());
itemOption.query();

var workNotes = "";
while(itemOption.next()){
workNotes += itemOption.question_text.toString() +" : "+ritm.variables[itemOption.name.toString()]+"\n";

}

current.work_notes = workNotes;
}
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

@varma2 Have you tried this?

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

@jaheerhattiwale 

 

I have tried and submit the catalog.

 

Thanks