What are the parameters for the GlideDialogWindow callback function?

will_smith
Mega Guru

I am having problems with this callback function in the GlideDialogWindow as I cannot figure out what it's returning. I am a new admin/developer in ServiceNow needing some help from the community. This took me 2 weeks to get sorted out, but I finally have it writing to the comments field successfully. Is this returning the sys_id of the username? I'm looking for it to return the username given in the form. Thank you in advance for your help.

function newCredentialForm(){

  var tableName = g_form.getTableName();

  //Get the values from the Incident Table

  var comments = g_form.getValue('comments');

  var work_notes = g_form.getValue('work_notes');

  var short_description = g_form.getValue('short_description');

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

  //Create and open the dialog form

  var dialog = new GlideDialogForm('Create Temporary Credential', 'u_temp_credential', callbackFunct);

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

  dialog.addParm('sysparm_view', 'credential_view'); //Use the Credential view of the form

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

  dialog.render(); //Open the dialog window

  }

//this is my callback function.   All I am doing is taking the username and using the setValue to place it in the additional comments field.

function callbackFunct(action, sys_id, table, displayValue) {

  g_form.setValue('comments',sys_id,'u_temp_credential','u_username');

}

1 ACCEPTED SOLUTION
5 REPLIES 5

DUGGI
Giga Guru

I think it will pass only sysid ,but you can manipulate using sysid.



function callbackFunct(action, sys_id, table, displayValue) {  


var userGr = new GlideRecord(sys_user'');


if(userGr.get(sys_id))


var userName=userGr.name;


g_form.setValue('comments',userName,'u_temp_credential','u_username');  


}  


bernyalvarado
Mega Sage

Hi William,



The following may be helpful:



GlideDialogForm - Error in Callback function


GlideDialogForm Popup has a CallBack!



Thanks,


Berny


Hi wilsmi, can we close this thread by marking the response as correct or do you have any further questions?



Thanks,


Berny


Yep! Is that something you guys have to do, or did I miss something?