- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Why is the first parameter always null in gsftSubmit(null, g_form.getFormElement(), 'server_side_script_name')?
I have read some documentation, but I am not able to understand the actual logic behind this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @surajkorade ,
gsftSubmit() is a client-side function used to submit a form to the server and trigger a UI Action or server-side script.
Its typical signature is:
gsftSubmit(action, formElement, actionName);
- action (first parameter)→ Represents the UI Action object (button/link) that triggered the submission.
- formElement (second parameter) → The actual form DOM element being submitted.
- scriptName (third parameter) → The name of the server-side script/UI Action to execute.
gsftSubmit(null, g_form.getFormElement(), 'server_side_script_name');
The reason is:
- The first parameter (action) is only used internally when a UI Action button is clicked directly. ServiceNow passes the button object automatically in that case.
- When you call gsftSubmit manually (from client scripts, custom logic, or other triggers), you don’t have a UI Action object to pass.
- So you explicitly set it to null to tell ServiceNow: “This isn’t coming from a button click; just run the script by name.”
function closeIncident() {
gsftSubmit(null, g_form.getFormElement(), 'close_incident');
}Here:
- null → No button object (not triggered by a click).
- g_form.getFormElement() → Submits the current form.
- 'close_incident' → The name of the server-side UI Action script to run.
-----------------------------------------------------------------------------------------------------------------------------------------------
If this information proves useful, kindly mark it as helpful or accepted solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @surajkorade
Passing null as the first parameter forces gsftSubmit to ignore the button itself and rely entirely on the 3rd parameter (the Action Name) to determine which server-side script to run.
Happy to help!
To help others in the community find this solution, kindly mark this response as the Correct Answer and Helpful.
Warm Regards,
Deepak Sharma
Community Rising Star 2025
