How do I refer to variables in variable sets in a client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 01:48 PM
I have a variable which is the only variable in a variable set. I am trying to modify this variable using a client script (g_form.setValue()) but it isn't working. I have another variable which is not in a variable set and that one can be set through g_form.setValue() in a client script. Currently I am referring to the variable in the set like this: g_form.setValue('<variable>','<value>','<display>') but I have also tried g_form.setValue('<variable set>.<variable>','<value>','<display>') and g_form.setValue('variables.<variable>','<value>','<display>') but none of these works. What is the proper syntax for this reference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2014 09:36 AM
Single Line Text. I have tried it with other types, none seem to work using the g_form.setValue() method. We have another example on our instance where this method does work on a yes/no variable (not in a set).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2014 10:22 AM
g_form.setValue('variablename', 'texthere');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 09:31 AM
I had similar problem on setValue. I had a variable directly under Service Catalog Variables. tried to set value on onLoad script.
Contacted Hi, that's when they said setValue works only with onChange script. It doesn't work with onLoad or onSubmit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2016 02:02 PM
I have a variable set (requested_for_set) using a variable name of requested_for.
I am trying to get the location field to autofill on the Task at the time it is submitted, loaded or changed.
Nothing works! Have been searching SN and Google for multiple weeks. Many solutions outdated.
My test instance is Istanbul, while our dev system and prod are Helsinki.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading)
return;
if (newValue == '') {
g_form.setValue('location', '');
return;
}
if (!g_form.getControl('location'))
return;
var reqLocation = g_form.getReference('requested_for');
g_form.setValue('location', reqLocation.location);