
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 09:58 AM
Can anyone please help me figure out how to get this script to work?
This is an INC record producer from the self-service catalog Get Help catalog item.
The last two "else if" statements are not working.
It is not applying the incident templates to incidents that are created with Category = "Inquiry / Help" and Subcategory = "HR (Do Not Include Confidential Info)"
same for incidents created with Category = "Applications" and subcategory = "Workday"
It is not applying the templates listed. The ERP if statements are working fine, just not the HR ones at the bottom of the script.
What am I missing?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 10:17 AM
You need to make sure you are using the correct values for the choices, not Label, so Inquiry / Help is likely 'inquiry'. Additionally, the logic doesn't make sense at first glance with these conditions nested inside of category = ERP and subcategory = D365, how can the Category be Inquiry / Help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 10:17 AM
You need to make sure you are using the correct values for the choices, not Label, so Inquiry / Help is likely 'inquiry'. Additionally, the logic doesn't make sense at first glance with these conditions nested inside of category = ERP and subcategory = D365, how can the Category be Inquiry / Help?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 11:11 AM
There are several categories and several options for each category.
Your suggestion for the label vs value was definitely my issue and the script now works as intended.
Thank you very much for this easy fix!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 11:43 AM
You are welcome!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 11:12 AM
This worked!
current.caller_id = gs.getUserID();
current.location = gs.getUser().getLocation();
var grLookup = new GlideRecord("dl_u_assignment");
grLookup.addQuery("location", gs.getUser().getLocation());
grLookup.query();
if (grLookup.next()) {
current.assignment_group = grLookup.assignment_group;
}
current.contact_type = "self-service";
current.impact = 2;
current.urgency = 2;
current.priority = 3;
if (current.category == "ERP") {
if (current.subcategory == "D365") {
if (current.u_level3_category == "Production Control") {
current.applyTemplate("ERP - Production Control");
} else if (current.u_level3_category == "Inventory Management") {
current.applyTemplate("ERP - Inventory Management");
} else if (current.u_level3_category == "Master Planning") {
current.applyTemplate("ERP - Master Planning");
} else if (current.u_level3_category == "Modules") {
current.applyTemplate("ERP - Modules");
} else if (current.u_level3_category == "Procurement and Sourcing") {
current.applyTemplate("ERP - Procurement and Sourcing");
} else if (current.u_level3_category == "Product Information Management") {
current.applyTemplate("ERP - Product Information Management");
} else if (current.u_level3_category == "Sales and Marketing") {
current.applyTemplate("ERP - Sales and Marketing");
} else if (current.u_level3_category == "Tablet") {
current.applyTemplate("ERP - Tablet");
} else if (current.u_level3_category == "Warehouse Management") {
current.applyTemplate("ERP - Warehouse Management");
} else if (current.u_level3_category == "Finance") {
current.applyTemplate("ERP - Finance");
}
}
}
if (current.category == "inquiry") {
if (current.subcategory == "hr") {
current.applyTemplate("HR Incidents");
}
}
if (current.category == "application") {
if (current.subcategory == "workday") {
current.applyTemplate("HR Workday Incidents");
}
}
gs.addInfoMessage("Thank you - we'll take a look and see what we can do to help");