Can you reuse a Variable Set and show a different question for the field each time

Nicole Downes
Tera Contributor

Is there a way to use an existing Variable Set in multiple forms, but have it display a different question.  

For example, the variable set is called Office and it has 5 options: Hobart, Melbourne Sydney, Perth and Adelaide.  

 

On form 1, I want the question to be:  In which office are you located?  

On the form 2, I want the question to be:  Which office should receive delivery?  

On form 3, I want the question to be:  Where is your home base?.  

Each time I want them to be shown the same 5 options.  

And when we open another office, say Darwin, I want to update the Variable set once, and it to be reflected in all three forms.  Is there a way to do this?

2 REPLIES 2

Musab Rasheed
Tera Sage
Tera Sage

Hello,

You can try using setLabel(String fieldName, String label) method in variable set and give catalog name as well in conditions but most probably this won't work and you can only do this with DOM manipulation which servicenow doesn't recommend.

So what I suggest is you remove that variable from variable set and create seperate individual variable for each catalog item, if you cannot remove variable from variable set then at least hide variable for those catalog items and display single seperate variable for them.

This is the best approach for your scenario

Please hit like and mark my response as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Nicole Downes
Tera Contributor

Thanks Musab,

Creating the catalog client script did as you outlined.  Thanks for the help. Example included below.

function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setLabelOf('Office', 'In which office are you located? ');
}