
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 07:49 PM
Hello,
We have a workflow where we are getting the catalog variables at the beginning of the workflow.
after this, we want to use the variables to populate the description of a change request. this is working perfectly, with one exception. we are unable to get the Text value of a dropdown (select box/choice) instead of the choice value.
I have tried getDisplayValue() and getLabel() both of which display undefined when being passed into the change description.
below is a copy of the script for the description field:
var shortDesc ="Please refer to "+fd_data.trigger.request_item.number+" For full server build details. \n\n";
shortDesc +="Location: Cloud - "+fd_data._1__get_catalog_variables.location_cloud+" \n";
shortDesc +="Operating System: "+fd_data._1__get_catalog_variables.operating_system.getDisplayValue()+" \n";
shortDesc +="Instance Type: "+fd_data._1__get_catalog_variables.instance_type+" \n";
shortDesc +="C Drive: "+fd_data._1__get_catalog_variables.c_drive+" \n";
shortDesc +="D Drive: "+fd_data._1__get_catalog_variables.d_drive+" \n";
shortDesc +="Business Criticality: "+fd_data._1__get_catalog_variables.business_criticality+" \n";
shortDesc +="Cost Centre: "+fd_data._1__get_catalog_variables.cost_center+" \n";
shortDesc +="Environment: "+fd_data._1__get_catalog_variables.environment+" \n";
shortDesc +="Support Group: "+fd_data._1__get_catalog_variables.support_group.name+" \n";
return shortDesc;
Operating System is the problem here on line 3 of the script.
Any advice would be greatly appreciated.
Regards
Nic Nagtzaam
Solved! Go to Solution.
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 08:01 PM
Hi,
are you sure your Get Catalog Variables Action has the variable included in it
operating_system
If that doesn't work use this
var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.operating_system.getDisplayValue();
var shortDesc ="Please refer to "+fd_data.trigger.request_item.number+" For full server build details. \n\n";
shortDesc +="Location: Cloud - "+fd_data._1__get_catalog_variables.location_cloud+" \n";
shortDesc +="Operating System: "+ variableDisplayValue +" \n";
shortDesc +="Instance Type: "+fd_data._1__get_catalog_variables.instance_type+" \n";
shortDesc +="C Drive: "+fd_data._1__get_catalog_variables.c_drive+" \n";
shortDesc +="D Drive: "+fd_data._1__get_catalog_variables.d_drive+" \n";
shortDesc +="Business Criticality: "+fd_data._1__get_catalog_variables.business_criticality+" \n";
shortDesc +="Cost Centre: "+fd_data._1__get_catalog_variables.cost_center+" \n";
shortDesc +="Environment: "+fd_data._1__get_catalog_variables.environment+" \n";
shortDesc +="Support Group: "+fd_data._1__get_catalog_variables.support_group.name+" \n";
return shortDesc;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 08:01 PM
Hi,
are you sure your Get Catalog Variables Action has the variable included in it
operating_system
If that doesn't work use this
var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.operating_system.getDisplayValue();
var shortDesc ="Please refer to "+fd_data.trigger.request_item.number+" For full server build details. \n\n";
shortDesc +="Location: Cloud - "+fd_data._1__get_catalog_variables.location_cloud+" \n";
shortDesc +="Operating System: "+ variableDisplayValue +" \n";
shortDesc +="Instance Type: "+fd_data._1__get_catalog_variables.instance_type+" \n";
shortDesc +="C Drive: "+fd_data._1__get_catalog_variables.c_drive+" \n";
shortDesc +="D Drive: "+fd_data._1__get_catalog_variables.d_drive+" \n";
shortDesc +="Business Criticality: "+fd_data._1__get_catalog_variables.business_criticality+" \n";
shortDesc +="Cost Centre: "+fd_data._1__get_catalog_variables.cost_center+" \n";
shortDesc +="Environment: "+fd_data._1__get_catalog_variables.environment+" \n";
shortDesc +="Support Group: "+fd_data._1__get_catalog_variables.support_group.name+" \n";
return shortDesc;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader