How can I call a UI Action from another UI Action?

eduardomendez
Kilo Explorer

Hey Everybody!

I need call a UI Action (TC_List) from another UI Action (Update).

Why?

The UI Action "TC_List" open a popup with the time card form, but when I save the form I need save the previous form (for this example INCIDENT FORM) too.

Add both UI Actions

TC_List

function showMyForm(){

var tableName = 'u_tiempo_real'; //specify the table for the Glide Dialog form  

var numero = g_form.getValue('number');  

  //Create and open the dialog form  

var dialog = new GlideDialogForm('TC', tableName); //Provide dialog title and table name  

dialog.setSysID(-1); //Pass in sys_id to edit existing record, -1 to create new record  

dialog.addParm('sysparm_view', 'default'); //Use the Add Inventory view of the form  

dialog.addParm('sysparm_form_only', 'true'); //Remove related lists  

  //Callback inserts values into the Computer record after data are returned from the server  

dialog.setLoadCallback(function(iframeDoc) {  

// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE  

var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;  

dialogFrame.g_form.setValue('u_num', number);  

});  

dialog.render(); //Open the dialog

      }

UPDATE

if((current.incident_state == 6 || current.incident_state == 😎 && current.close_notes.toString().length <30){

      gs.addInfoMessage(gs.getMessage("The number of characters in the field Close Notes must be greater than 30"));

      action.setRedirectURL(current);

     

} else if(current.incident_state == 3 && current.comments == '' && current.work_notes == ''){

      gs.addInfoMessage(gs.getMessage("You must complete the comment field or work notes field"));

      action.setRedirectURL(current);

}else {

              if(current.incident_state == 5){

              gs.eventQueueScheduled("IntervProgramada", current, gs.getUserID(), gs.getUserName(), current.expected_start);

      }

}

Any Idea!?

10 REPLIES 10

Nothing special, just call the function by name.



i.e., if you define function validateNumber(...){...} attached to an onLoad script for your form, then your other client scripts (e.g., onChange) can call it just as:



        "var result = validateNumber(...);"




Make sense?



-Brian