
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2017 07:55 AM
Hello
I trying to keep this simple and align with ServiceNow OOTB features. Currently in ServiceNow on an Incident Record there is Category (string) and Subcategory (reference) fields. I am creating a Service Portal/Catalog form request to get End User values and directly create an Incident record; standard or basic Help Desk form "I have a problem and need to create an Incident". So my thinking was to match to the exact current "Category" and "Subcategory" field values of our ServiceNow instance, that way the values stay consistent with the values on the service catalog form vs. creating two static choice string fields and just passing the values to the incident record; more maintenance keep the form up to date with Incident record field values.
I am having two issue.
1.) I am struggling in getting the string values of the 'Category' field from the Incident table to appear on my catalog from. I am using a reference field type on my catalog form but obviously the Category field on the Incident table is just a string box, and I am not able to find an appropriate table to reference, which maybe reason why it is not working. So how do I reference this field from the Incident table? Or am I just going to need to create a choice field with the same values as on my Incident Category column field?
2.) Not seeing how to make the Subcategory field dependent on Category field selection like it is done within the Incident record. I found the following article, so do I still need create a script include to make this functionality work on the catalog form request? Or is there already an Out-of-the-box script include for the this function? http://wiki.servicenow.com/index.php?title=Adding_Dependent_Reference_Variables#gsc.tab=0
______________________________________________________________________________________________________________________________
Fig #1
______________________________________________________________________________________________________________________________
Fig #2
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2017 04:17 AM
You should just use Select Box for the Category/Subcategory on the record producer.
I recently ran into a problem where I couldn't filter subcategory based on category on Service Portal. This link helped with that: Dependent Variables in Service Portal do not reload on values when changed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 04:27 AM
Have you tried JSON.stringify(subcategories)? Make that change then use g_form.addInfoMessage(answer) on your client script to check your response and make sure you're returning your values or gs.log in your script include right before your return to make sure your JSON string looks correct.
Cary

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 05:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 07:19 AM
Hi Michael,
Okay removed Choice table: Incident, Choice field: subcategory and now see no values. Also I might be mixing up my SN terminology. I am using the same out-of-the-box catalog item you referenced to directly create an Incident record vs. passing through a workflow. Thought this method was called a 'record catalog item record producer'.
-Wesley

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 07:40 AM
And from the previous article, is the script exact? The script should grab the dependent subcategories.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 08:03 AM
Hi Michael & Cary,
Uhhhhhhhhhggggggg!
Found the issue because Michael mentioned 'request item' vs. record producer. I needed to change gp.addQuery("name", "sc_req_item") to gp.addQuery("name", "incident") of the Script Include (HMgetCat). I still maybe confused on terminology but hopefully I am okay taking a catalog item (form) and having it directly create an Incident record. Now with Category and Subcategory working as OOB from the Incident table, when the form is submitted, the Incident record will be assigned to the appropriate Assignment Group and or Assigned To person.
Thanks for staying patient with me and continuing to provide feedback and answers!
-Wesley