- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 03:02 PM
Hi
I am having an issue with the incident reference field subcategory displaying sys ID instead of name. originally the field was a look-up list type. I had to change it to reference type(sys_choice) to modify the variable attributes(ref_ac_order_by) in order to show the desired list sequence in the portal. Now that the desired list is achieved, after submitting an incident request, the subcategory shows the sys ID. How can I display the Name? this is script that in the record producer. I tried to add current.subcategory = producer. subcategory; it didn't work.
current.category = 'information_security';
current.caller_id = gs.getUserID();
current.assignment_group = '****'; // Department name
// Added new routing
// Removed routing for specific subcategories
if(producer.subcategory == 'subcategory1' || producer.subcategory == 'subcategory2' || producer.subcategory == 'subcategory3' || producer.subcategory == 'subcategory4' || producer.subcategory == 'subcategory5'){
var gr = new GlideRecord('incident');
gr.initialize();
gr.assignment_group = '****'; // Department name
gr.short_description = "Information security request " + current.number + " needs input";
gr.description = "Please access the information request through the 'Parent' field on this incident.\nCategory: " + current.subcategory.getDisplayValue() + "\nIncident summary: " + current.short_description + "\nDetails: " + current.description;
gr.caller_id = '****'; // User name
gr.u_customer_name = current.u_customer_name;
gr.category = '****'; // Category name
gr.parent = current.sys_id;
gr.insert();
current.u_involved_department = true;
}
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 06:34 PM
Hi @Sam M3 ,
I assume you are referencing sys_choice table, if yes try with the below line in your record producer script.
current.subcategory = producer. subcategory.value;
If it didn't work try this,
var chGr = new GlideRecord('sys_choice');
chGr.get('sys_id', producer.subcategory +'');
current.subcategory = chGr.value;
Thanks,
Anvesh
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 04:18 PM
Hi @Sam M3,
Try to use current.subcategory.getDisplayName() instead of current.subcategory.getDisplayValue()
Thanks,
NS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 06:34 PM
Hi @Sam M3 ,
I assume you are referencing sys_choice table, if yes try with the below line in your record producer script.
current.subcategory = producer. subcategory.value;
If it didn't work try this,
var chGr = new GlideRecord('sys_choice');
chGr.get('sys_id', producer.subcategory +'');
current.subcategory = chGr.value;
Thanks,
Anvesh
Anvesh