Getting onsubmit() error While using gsftSubmit();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 06:10 AM
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);
}
}
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.
And I 'm just given these Conditions:
(current.state!= 3 && current.state != 6&¤t.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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 09:42 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 08:27 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader