g_form.getValue is not working in portal

Community Alums
Not applicable

This is my code:

function onLoad() {
//Type appropriate comment here, and begin script below
var msg = parent.g_form.getValue('messenger_service');
if (m.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var fold = parent.g_form.getValue('folding');
if (fold.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var ps = parent.g_form.getValue('postage_stamps');
if (ps.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var insert = parent.g_form.getValue('inserting');
if (insert.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var label = parent.g_form.getValue('labeling');
if (label.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var tab = parent.g_form.getValue('tabbing');
if (tab.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}
var other = parent.g_form.getValue('other');
if (other.toString() == 'true') {
g_form.setValue('vs_account_otf', '');
}


}

1 ACCEPTED SOLUTION

Community Alums
Not applicable

I done it myself instead of using parent.g_form.getValue use g_service_catalog.parent.getValue

View solution in original post

2 REPLIES 2

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Community Alums ,

At the time of form load all those variables are pre-filled ?

messager service , folding ,postage stamp etc?

Because it is onload script.parent. g_form is UNDEFINED from the onLoad() event of MRVS; therefore no getValue() function may be called on it. 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Community Alums
Not applicable

I done it myself instead of using parent.g_form.getValue use g_service_catalog.parent.getValue