The CreatorCon Call for Content is officially open! Get started here.

How to Make a Question Dependent Upon Previous Question in Service Catalog

jmiskey
Kilo Sage

We are creating a Service Catalog that has some questions that are dependent upon the answer to the previous question.   For example, we have the following tables in a custom application:

Site: key field is Site Location

Service: key field is Service Name

Site Service Mapping: Table that has two fields (Site and Service), and has a record for each Site/Service that is offered

For example:

Site

Location1

Location2

Location3

Service

Service1

Service2

Service3

Site Service Mapping

Location1     Service2

Location1     Service3

Location2     Service1

Location3     Service1

Location3     Service2

Location3     Service3

So, in my Service Catalog, I have added an Item, and then two Variables to this Item for the two questions.

The first Variable is a Reference type, and asks the person to select their Site from the list.

The second Variable is also a Reference type, and asks the person to select their Service from the Site Service Mapping.   So, basically, what should happen is that after the user selects their Site, the second Variable should be filtered based on that site to only show the Services available for that Site.   For example, if the user selected Location1, it would only show Service2 and Service3 in that second Variable, since those are the only two services offered at Location1.

It looks like this should be fairly easy/straightforward is we were able to take the value selected from the first variable, and use it in the Condition (Reference qual condition) of the second variable.   But we have been unable to figure out the syntax to do that (maybe it is not possible)?   One way we tried was a condition like this:

Site is javascript: g_form.getValue('LocationRequest');

(where LocationRequest is the name of the first variable).

So, the question is, can this be done via this manner, and if not, how do we accomplish this (where we get the answer from the first variable and apply to filter the list for our second variable)?

Thanks

8 REPLIES 8

You can populate the Site and service from the mapping table. Make Service Field is dependent of Site.


Based in the Site and service value, You can use the mapping other dependent value.


Not sure I follow.   While I have seen this "Dependent" field in other Modules, I don't see it in the Variables section of the Service Catalog.


Can you explain exactly how you would implement your suggestion?


Correct, You have to add onChange client script to make the dependent variable.


Check the below wiki page for reference.


http://wiki.servicenow.com/index.php?title=Adding_Dependent_Variables#Create.C2.A0Two_Variables_for_...


Hmmm... This does not appear to be working.   Have you tried to use this in the Service Catalog (that is where we are trying to use it).



I took it to my co-worker, who has a bit more experience than I, and he uses the method described in the link and has gotten it to work elsewhere, but it didn't work for him in the Service Catalog either.


mahnooshhenshaw
Kilo Contributor

How can I shows this in my question item for one my service catalogue:

I have three lists. The list one is my first question. Based on the first question I want to shows the lists 2 options. How can I do that ?

List 1- Request Type:

Service

Consultation

Proposal

Tech Support

 

List 2- If selection Service then list should show:

Server

Desktop

Network

Security

List 2: If selection is Consultation then the list should show

Server consulting

Desktop consulting

Network consulting

Security consulting

List 3: If selection is Consultation then the list should show

Server Proposal

Desktop Proposal

Network Proposal

Security Proposal