Pass values when calling a GlideDialogForm with a UI Action

sreed
Kilo Explorer

Im working on a UI Action that calls up a GlideDialogForm from a Catalog Task. Im using a bit of code I found here:
http://www.servicenowguru.com/system-ui/glidedialogwindow-quickforms/


function showMyForm(){
//Get the table name and sys_id of the record
var tableName = "u_token_transaction";
var tasknum = g_form.getValue('current.number');
var reqcust = g_form.getValue('current.u_requested_for');


//Create and open the dialog form
var dialog = new GlideDialogForm('Assign Token', 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', 'AssignToken'); //Specify a form view
dialog.addParm('sysparm_form_only', 'true'); //Add or remove related lists
dialog.render(); //Open the dialog
}

Heres my problem- I want to pass a couple values from the current form into the Assign Token form when it is launched. I cant find any documentation that specifies the syntax and none of my guesses seem to work. I want something that is the equivalent of
dialog.setValue('u_task_number', tasknum); (which of course doesnt work).

18 REPLIES 18

Valor1
Giga Guru

Have you tried calling g_form.setValue() after form render?

This is not an optimal solution, but you could also make a client script to run for that view only that would make a server call to get the last-saved data from the DB.


By the way, we just released documentation around the g_form API, which might help you out:

http://wiki.service-now.com/index.php?title=GlideForm_(g_form)

Guy Yedwab
SNC Documentation


OK, it's 2015 now and alot of water has flowed over the dam since this posting.


I have similar needs and I'd like to see this reference.   But it's an empty page now.


Any chance that it exists in another location?


sreed
Kilo Explorer

Im glad to see the new documentation!! That page should be quite useful in the future.

g_form.setValue after form render didnt get me anywhere. No error, but no response either.

I suppose I could write a client script but that seems like an awful lot of work just to pass a couple values into the popup!!!