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

Hey,



Thanks for the awesome information.


i have one more question.


is there any way to extract the information from this form?


i just want to pick the updated fields and populate them on a different record.



any thoughts on this?



Thanks in advance!


hi  @Chris.Hann  ,

Can you please me , I have used dialog.addParam() in my dialog form to set multiple fields but only the last line mentioned to set one of the field in the script is setting the field value not other.

Regards

Garvit

Chris_Hann
ServiceNow Employee
ServiceNow Employee

Create a view-specific UI Policy (Uncheck the Global and provide your View name).


peter_repan
Tera Guru

Hi Sreed,

I know it's a quite late answer by maybe someone finds it handy for the future: 

When you have an iframe in the popup and want to access field on the "bottom" form, you can use javascript like:

parent.g_form.getValue('<field_name>');