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

Please share your screenshot with code.

 

 


Thanks and Regards,

Saurabh Gupta

Please share your screenshot with code.



Thanks and Regards,

Saurabh Gupta

HI @Saurabh Gupta  

 

I have attached the screenshot. Please suggest.

 

Thanks.

Thanks,

Hi,
You need to change few thing instead of "tr" you should write "current.request_itemgetRefRecord()"

First Line

var vs = new GlobalServiceCatalogUtil().getVariablesForTask(current.request_item.getRefRecord(), true); 

also add at the end of code just above below comment

//notes is the variable that contains all the variables with its values including multi row variable set.
current.work_notes=notes;





Thanks and Regards,

Saurabh Gupta

Hi,
Have you done these changes?

 

 


Thanks and Regards,

Saurabh Gupta