Yatharth Batra
Tera Expert
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-15-2022 03:33 AM
For action ""Submit Catalog Item Request"" in flow designer, if you are also having an issue with populating value in list collector variable (problem statement details below)
Submit Catalog Item Request action | ServiceNow Docs
try invoking below javascript (add scripted action with below code & try calling it directly via action or sub-flow) to pass the catalog variable in list collector:
(function execute(inputs, outputs) {
// Variables to hold value of RITM variables
var svrStr;
var svrList;
// This is to retrieve old RITM to fetch values from
var ritm_gr = new GlideRecord('sc_req_item');
ritm_gr.addQuery('sys_id',inputs.oldRitmNum);
ritm_gr.query();
while(ritm_gr.next())
{
svrList = ritm_gr.variables.<<variable1_name>>.getValue();
svrStr = ritm_gr.variables.<<variable2_name>>.getValue();
}
// This is to fetch new RITM to copy values to
var ritm_gr1 = new GlideRecord('sc_req_item');
ritm_gr1.addQuery('sys_id',inputs.newRitmNum);
ritm_gr1.query();
while(ritm_gr1.next())
{
ritm_gr1.variables.<<variable1_name>>.setValue(svrList);
ritm_gr1.variables.<<variable2_name>>.setValue(svrStr);
ritm_gr1.update();
}
// Outputs mapped to verify the action los at end (optional and below lines could be removed also)
outputs.output_new_ritm_val2 = ritm_gr1.variables.<<variable1_name>>;
outputs.output_new_ritm_val1 = ritm_gr1.variables.<<variable2_name>>;
outputs.output_old_ritm_val2 = ritm_gr1.variables.<<variable1_name>>;
outputs.output_old_ritm_val1 = ritm_gr1.variables.<<variable2_name>>;
})(inputs, outputs);
- 1,248 Views