g_form.getValue() return the value and not the name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2018 10:51 AM
Below is the code i use for the record producer. I need to get the Name but it returns the value.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert ('load');
var choice = g_form.getValue('pay_discrepancy_type');
alert (choice);
g_form.setValue('pay_dependancy_inquiry', 'Please ' + choice + ' attach');
}
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2018 01:18 PM
I haven't tested this against that type of variable, so it could be the case. If you run this and open your browser's console it should give you the actual error message it references. If you're in chrome you can do to Settings > More Tools > Developer Tools to show the console.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2018 03:56 AM
while running Client Script "Mandate test": TypeError: g_form.getOption is not a function

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2018 06:12 AM
Are you running this in Service Portal by chance? It doesn't look like g_form.getOption is available when run from SP, unfortunately. I don't think there is currently an alternative method, so if you absolutely need the display value in SP you may end up have to pass the value to a script include, then query the choice list in question for the display of that value and return it to the client.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2018 12:35 PM
I'll give this a try. Thanks again Brad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2018 07:31 AM
if you able to change the data type then it will work.
in place of Multiple Choice you if you take Select Box then it will work properly.