Change value on case form if case variable changes

Julia Howells
Giga Guru

Once a case is submitted via the portal or catalog, the case variables tab value can be changed. If the 'application' variable is changed, it should change the 'application' form value to match. 

I think I need an OnChange Catalog Client Script but am having trouble writing this. 

See below for what I have started and please let me know if there is a better way to do this! 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    if (newValue != oldValue)
        g_form.setValue('???');
}
1 ACCEPTED SOLUTION

Julia Howells
Giga Guru

//if product changes on the variable, update on the form

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

if (newValue != oldValue)
g_form.setValue('application', newValue);
}

View solution in original post

2 REPLIES 2

Julia Howells
Giga Guru

//if product changes on the variable, update on the form

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

if (newValue != oldValue)
g_form.setValue('application', newValue);
}

I figured it out but keeping posted in case it helps anyone else.