0
Name: -Button Name-
Action name: -type_button_action- (Should be unique per button on form and gets called from the UI Action script)
Client: True (Mchecked)
Onclick: -ClientSideScript();

Script:

//Client-side 'onclick' function
function ClientSideScript(){
if(g_form.getValue("active") == false){
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'type_button_action'); //MUST call the 'Action name' set in this UI Action
}//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if(typeof window == 'undefined')
runBusRuleCode();

//Server-side function
function runBusRuleCode(){
current. = ;
current.update();
gs.addInfoMessage('You did it!');
action.setRedirectURL(current);
}
How to write Client & Server Code in One UI Action (gsftSubmit with example) ServiceNow
admin Changed status to publish December 19, 2023

Why we use null as first parameter of gsftsubmit.

function gsftSubmit(control, /* optional */ form, /* optional */ action_name)

Based on the variable name, it's a control object (perhaps that passed back from g_form.getControl()

For more information use below article

https://www.servicenow.com/community/developer-forum/gsftsubmit-null-form-element-ui-action-name/m-p/1955198