Record producer with variables stored in another table?

graham_c
Tera Guru

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:

  1. Store questions against Service Offering records (to allow support teams to edit these questions as and when)
  2. On the Create Incident Record Producer display these questions based on the Service Offering the user has selected dynamically.
  3. Set these questions to be mandatory to ensure the users are filling in this information.
  4. Once the record producer has been submitted, show these answered questions on the Incident form.
  5. 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

1 ACCEPTED SOLUTION

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


View solution in original post

7 REPLIES 7

mrswann
Kilo Guru

have you looked at Order Guides ?


Hi,



I have looked at Order Guides but this mean we would have to create separate catalog items for each Service Offering, and wouldn't allow the support teams to edit these questions without a ServiceNow admin. Plus this wouldn't be creating Incident records.



Thanks


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


Hi Julian,



I hadn't considered doing that but I think it could work!



To build upon your idea, does it seem feasible that:


  1. I create 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 and an order field.
  2. I build 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 available.
  3. Add all variables to the form and set them all to be hidden via on load client script.
  4. 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. Increment the type and continue looking at the questions adding them in where required.


It's a little long winded but in theory it should work. I'll try it in my instance and see how far I get!



Thanks