what is the Use of gsftSubmit , why should we use it, when use it?

chanikya
Tera Guru

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);
}

11 REPLIES 11

Hi Jaspal,

I'm also searching for the same info. I've a question - I've defined client script and Processing Script in UI Page. Many functions as defined in the Processing Script field. If I use gsftsubmit(this) function in HTML page how to identify which function should execute first from Processing Script.

Regards,

Suresh.

Regards,
Suresh.

Priyanka Chandr
Mega Guru

Hi,

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. It is mostly used in UI actions that have a client side and a server side script.

Please have a look into this also

https://community.servicenow.com/community?id=community_question&sys_id=cefe7229db58dbc01dcaf3231f96...

Please mark it correct and helpful, if applicable

Thanks,

Jansi1
Tera Contributor

Hi,

Please check below link:

https://servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/

Thank you!!

Pooja Yerpude
Tera Contributor

Hi,

 

I have used gsftsubmit and third parameter is action name which is same as that of function written for server side code run in same UI Action, but code written in function isn't working why this is so.

Amruta007
Tera Contributor

dfdf