How to set more information on catalog item variable when condition met.

vinod9
Tera Expert

Hello Team

 

I have requirement to show different more information on one single variable in catalog item.

 

Example: Variable A has drop down B and C

 

when I select "B" in variable A then it has to show more information "first selection" in another variable "S".

when I select "C" in Variable A then it has to show more information "second selection" in "S" variable.

 

According to the selection it has to show different more information on the "S" variable.

Please help me to resolve it 🙂

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage
Tera Sage

@vinod9 

 

Write a onchange client script on variable A and use below script to achieve your requirement

 

if(newValue=="B"){

g_form.showFieldMsg("S","firstSelection');

}else if(newValue=="C"){

g_form.showFieldMsg("S","SecondSelection');

}

 

I hope this helps!

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

 

View solution in original post

3 REPLIES 3

Rahul Kumar17
Tera Guru

Hi @vinod9 ,

 

To show different information in a single variable based on the selection of another variable in ServiceNow catalog item, you can use the "Variable Dependencies" feature. Here are the steps to configure this:

  1. Create your catalog item: Create your catalog item and add the "Variable A" and "S" variables.

  2. Create new options for Variable A: For Variable A, create two options, "B" and "C", and add the additional information for each option in the "Help Text" field.

  3. Configure the dependencies: Navigate to the "Variable Dependencies" related list for Variable A and create two new dependencies, one for each option:

  • For option "B": Set the dependent variable to "S" and set the "Value When" field to "B". In the "Dependent Variable Display" field, add the information you want to display for "B" selection.
  • For option "C": Set the dependent variable to "S" and set the "Value When" field to "C". In the "Dependent Variable Display" field, add the information you want to display for "C" selection.
  1. Test the catalog item: Save the catalog item and test it by selecting "B" and "C" options in Variable A to see if the additional information is displayed in Variable S as expected.

By following these steps, you can show different information in a single variable based on the selection of another variable in a ServiceNow catalog item.

 

Thanks,

Rahul Kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

Prince Arora
Tera Sage
Tera Sage

@vinod9 

 

Write a onchange client script on variable A and use below script to achieve your requirement

 

if(newValue=="B"){

g_form.showFieldMsg("S","firstSelection');

}else if(newValue=="C"){

g_form.showFieldMsg("S","SecondSelection');

}

 

I hope this helps!

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

 

@Prince Arora  Thank you 🙂
It worked for me