what is the Use of gsftSubmit , why should we use it, when use it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:23 AM
Hi,
Please don't copy and past WIKI information, please explain in your own words..
why should we use, ?? when ??? why??? what is the purpose
i have taken this script from wiki.. what is explains here , : UI action: Reopen Incident
already we have UI action name ,so whay should we use gsftSubmit ????
function reopen(){
if(g_form.getValue('comments') == ''){
//Remove any existing field message, set comments mandatory, and show a new field message
g_form.hideFieldMsg('comments');
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments','Comments are mandatory when reopening an Incident.','error');
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); //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')
serverReopen();
function serverReopen(){
//Set the 'State' to 'Active', update and reload the record
current.state = 2;
current.update();
gs.addInfoMessage('Incident ' + current.number + ' reopened.');
action.setRedirectURL(current);
}
- 51,881 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:30 AM
It is mostly used in UI actions that have a client side and a server side script.
gsftSubmit(null, g_form.getFormElement(), "ui action id") triggers the UI Action which is specified in the 3rd parameter, which is the action name/element id.
At the end of the client side script, you call gsftSubmit in order to trigger the UI Action again - this time running only the server side code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:38 AM
Hi,
i didn't understand it properly, already we have UI Action name and Button in incident table right??
then what is the purpose of this using .....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:57 AM
Just check this link it will resolve your query
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 08:08 AM
Hi Chanikya,
gsftSubmit is used to execute the Server-side section of the script after the client-side portion has been completed successfully.
For eg. in your case till the time
g_form.hideFieldMsg('comments');
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments','Comments are mandatory when reopening an Incident.','error');
validation is not successful at the Client side, Server-side function would not be initiated.
Passing Action name as parameter in gsftSubmit ensures the Client side validation to move ahead.
Hope this gives clear understanding.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.