Getting onsubmit() error While using gsftSubmit();

Aditya02
Tera Guru

Hello everyone,

I am getting this onSubmit script error: TypeError: Cannot read properties of null (reading 'document'):
function () { [native code] },  While using it in an Ui action.

 

Here, Is the script I'm using: 

function reviewAndApproval() {
var cst = parseFloat(g_form.getValue('estimated_monthly_credit_required')) || 0; // Ensure it's a number

if (cst > 100000) {
g_form.setValue('state', 5);

gsftSubmit(null, g_form.getFormElement(), 'review_and_approval');

}
}


if (typeof window == 'undefined')
serverReview();

function serverReview() {
if ((parseFloat(current.estimated_monthly_credit_required) > 100000)) {
current.state = 5;
current.update();
}
}

 

Even I tried with g_form,Submit(), It returned the same error.

 

Aditya02_0-1742216884913.png

 

And I 'm just given these Conditions:
 (current.state!= 3 && current.state != 6&&current.state != 4 ) && (gs.hasRole("u_cg_accounts_receivable_user") )&&(current.u_type_of_support == "aged_and_bad_debt")&&(current.variables.types_of_aged_and_debt=="third_party_credit_application")

Anyone Help me out to get this requirement done.. Thank you in advance

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Aditya02 

is that field "estimated_monthly_credit_required" on the form view which shows that UI action?

If it's not then it will throw error

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Aditya02 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader