- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 03:18 PM
Hi all,
I am trying to build a Record Producer to create Incidents but the variables I need to be displayed on the form need to be loaded dynamically based on what has been selected in the form so far.
Basically my user case is that we want the user to answer two variables on the form to select the Business Service and the Service Offering impacted. The Service Offerings are associated to Business Services (e.g. Business Service = Email, Service Offering = Inbound Emails). For each Service Offering we have defined a set of structured questions that we want the user to answer to help us understand their incident. These questions are tailored to each Service Offering, so there is very little cross over of questions between them so using the example of the Inbound Email Service Offering, some of the questions would be "Have you asked someone local to you to send you an email?", "Have you checked that you are connected to the network?" etc.
I know that we can add variables onto the record producer and use a UI Policy to show/hide variables based on what has been entered in the Service Offering variable, however there are lots of questions defined per offering and the Incident Support Teams wish to be able to edit these questions as and when required without relying on ServiceNow Admins to make changes to the Record Producer itself. In other words I'm trying to make data-driven variables oposed to static generic variables.
My thoughts so far is that we could make a custom table (Service Offering Questions) that will store the questions for each Service Offering and give the Incident Support teams the relevant roles to access them. Then on the Create Incident Record Producer, add a UI Macro or something that will go and retrieve these question records and display them on the Record Producer as manatory input boxes. My problem is I'm not sure if this is even possible in ServiceNow or really where to start writing the code to do it.
In summary I need to:
- Store questions against Service Offering records (to allow support teams to edit these questions as and when)
- On the Create Incident Record Producer display these questions based on the Service Offering the user has selected dynamically.
- Set these questions to be mandatory to ensure the users are filling in this information.
- Once the record producer has been submitted, show these answered questions on the Incident form.
- These answered questions would need to be reportable in the same capacity as other fields on Incident.
Does anyone have any ideas on how or if this can be achieved?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 12:53 AM
All I can think of, but then again it is a bit of work and I can see one major stumbling block
Create a Variable Set with however many questions you feel you may need and attach this to whatever producers
A client script that can read the Service Offering question table and retrieve the questions / choices.
The same script can then be used to change the label of "Question x" to be whatever is required.
I am just not sure how this would cover the different types of input choices - not tried to change that on the fly.
If you can get the variable to change type then it is a question of how best to store the data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2016 12:35 AM
Hi Julian,
I've finally managed to attempt this and I can happily say that it worked!
For those interested this is the approach I took:
- I created a Service Offerings Questions table where the records hold title, type (with Single Line Text / Multi Line Text / Date etc as options), reference to the Service Offering, an order field and a tick box called mandatory.
- I built a variable set for the Incident Record Producer holding 10 single line text box variables (called SL1, SL2, SL3 etc), another variable set holding 10 multi-line text box variables (called ML1, ML2, ML3 etc) .... repeat for number of variable types you want.
- Add all variables to the form and set them all to be hidden via on load ui policy.
- Create an on-change client script that runs a script includes on change of the Service Offering field to go and get the Service Offering's Questions in order, then display the first relevant variable type based on the question type, rename it to the title and set to mandatory if required. Increment the type and continue looking at the questions adding them in where required.
- This creates the questions on the record producer, however the once submitted the names of the variables reverted back to their original names (SL1, ML1 etc). To get around this I wrote into the script of the record producer to pull through the question label, and create records in a new table called "Incident Answers" with the question name and the question answer.
Thanks for your support, it got me where I wanted in the end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2016 01:18 AM
Coolio
Only question I have is how you set the order so that the variables appear in the "correct" places. I guess this maybe changable - just not tried.
Or did you place all the xx1 variables together and then all the xx2 and so on ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2017 01:55 AM
Hi Graham,
I'm trying to achieve something similar. I would want to try on this.... I don't quite get point #5, how do you get the question label?