- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎12-04-2016 06:00 PM
I have come across a requirement from a client that they would like to have ability to select multiple options / values on a variable in service catalog but did not like the appearance of List Collector. Also they were looking to have a hierarchal view i.e. when a checkbox is clicked it should display child options / values.
I realized that there is currently no variable type in ServiceNow that could satisfy this requirement hence I have created my own and would like to share it with you.
Lets take a scenario to explain the requirement and solution clearly.
Customer Requirement:
Customer is building 'New Employee Hire' service under 'Onboarding Services' in Service Catalog. On the first page of order guide, I have added an option for 'Location Services'.
When this is checked and you proceed to 'Choose Options', user would like to see a tab for capturing location requirement.
Once selection is made user would click on checkout. After request is submitted when user navigates to the 'Location Access' requested item. All the locations selected are visible in the same hierarchal view.
Technical Implementation:
For the purpose of building this I have created a UI Macro, Script Include and Catalog Client Script. Please note that this code may not fully satisfy ServiceNow best practices guidelines and is shared just to give you a starting point for your requirement.
UI Macro:
Created a UI Macro "multiselect_checkboxtree" for the variable that would display list in hierarchal view.
Script Include:
Created Script Include "MultiSelect_CheckboxTreeAjax" which would do the glide query to the table.
Variables
Creates two variables in your catalog item as below:
- Locations Access Required, this will be used to display multiselect hierarchal checkbox.
Type: Macro with Label
Name: locations
Macro: multiselect_checkboxtree
Question: Locations Access Required
ii) Location Values, this will be used to store & retrieve values selected on form.
Type: Single Line Text
Name: location_values
Question: Location Values
Catalog Client Script:
Created Catalog Client Script "onLoad Locations Value" which would manage setting checkbox values.
The solution is packaged into the attached update set, feel free to load and commit this update set on your sandbox first before implementing at client instance.
Please share your views on this solution and any enhancements you make.
Cheers
Syed Atif Faheem
Technical Consultant
Emerging Services, ServiceNow.
- 5,328 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hey Syed,
This looks great! I tried it out on my instance and I've got a couple questions:
1) It looks like when you load the catalog item, your test item is in a Catalog that doesn't exist out-of-box -- this may be why I got some collision warnings when I went to apply the update set (on the item and the guide)
2) I went to try reporting against the variable and had some difficulty. ServiceNow doesn't support reporting against it because it doesn't report against variable sets:
So I was using Explore Analytics, which can handle variable sets, but it looks like it's storing the data as comma separated list of sys_ids:
What table are you drawing the sys_ids from?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hu Guy,
Thanks for you feedback and question. These are sys_ids from cmn_location table. If you are looking to use display value for location you can use name attribute of checkArray instead if id in ui macro multiselect_checkboxtree.
Cheers
Syed.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Is this functionality implemented Istanbul OOB ?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I have a same requirement like this in form creation and if parent is checked children under that parent should be checked as well
how i can create this same structure in form , please let me know
my email id is sreelusrikanth@gmail.com
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I ran across this in my installed plug-ins on my Tokyo IDE (I have all the GRC and APM stuff installed so it might not be base) @devsnc/sn-hierarchical-select
I cannot find much documentation on it here or developer.service-now.com or the docs. Is it useable by developers? How do I find out more about it?