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

Santhana Rajhan
Mega Sage

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');

}

10 REPLIES 10

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.

while running Client Script "Mandate test": TypeError: g_form.getOption is not a function

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.

I'll give this a try. Thanks again Brad

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.