Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

g_form.getValue is not working in portal

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

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

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

Not applicable

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