Step 1:
Write mail script and add below code in Notification.
Name : variables_value_catalog_summary
template.print("Summary of Requested items:<br />"); var item = new GlideRecord("sc_req_item"); item.addQuery("sys_id", current.sys_id); item.query(); while(item.next()) { var keys = []; var set = new GlideappVariablePoolQuestionSet(); set.setRequestID(item.sys_id); set.load(); var vs = set.getFlatQuestions(); for (var i=0; i < vs.size(); i++) { if(vs.get(i).getDisplayValue() != '') { template.space(4); template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "<br />"); } } }
Step 2: Use below code in notification
${mail_script:variables_value_catalog_summary}
How to add Variables value in Notification ServiceNow?
Working Code Edited question August 2, 2023