Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action to display pop up record producer

Lisa Silvaroli
Tera Guru

I have a UI Action that I need to open up a pop-up record producer in the view of a catalog item. 

Using this code:

function userPopup() {
	var dialog = new GlideDialogForm ('Create User', 'sc_cat_item_producer', createNewUser);
	dialog.setTitle('Create User');
	dialog.addParm('sys_id', 'c882d170db91af00e34d001b8a961943');
	dialog.addParm('preview', 'true');
	dialog.addParm('sysparm_view','servicecatalog_cat_item_view');
	dialog.addParm('',"summary");
	//dialog.addParm('sysparm_form_only', 'true');
	dialog.render();
}
function createNewUser (action, sys_id, table, displayValue){
	g_form.setValue('u_conact', sys_id);
}

It is rendering the following:

find_real_file.png

But I need it to render the record producer itself (similarly to how it is displaying when you click on "try it" in the previous screen shot

find_real_file.png

 

I have tried changing every different view I can think of in the code for the UI Action but cannot get it to display as above when clicked. Does anyone know how I can achieve this?

3 REPLIES 3

Chalan B L
Giga Guru
Hello ISIL, All I could say is in the UI action itself .. can't we call the catalog item URL. This thread may help you. https://community.servicenow.com/community?id=community_question&sys_id=faf04ba5db98dbc01dcaf3231f961979 Regards, Chalan

Gabbey
Tera Contributor

Hello Lisa,

  

I have the same issue here, did you solve the issue and could you please share it?

 

Br,

Gabriel

adamn
Tera Contributor

Its an old question but as I have an answer and others may need it:

 

var dialog = new GlideDialogForm ('Some Name for the Dialog', 'com.glideapp.servicecatalog_cat_item_view');
dialog.setTitle('Some Title'); // Title for the Dialog
dialog.addParm('sysparm_id', 'ddbbf72fdb9125106122be32f39619e3'); // Sys ID of the record producer you want to display
dialog.addParm('preview', 'true');
dialog.render();

This runs in any client side context. The only values you need to customise are setTitle and the Sys ID in the sysparm_id parameter.

 

This will pop the Record Producer as a dialog. Other standard dialog options (eg width control) are usable.

The dialog will redirect per the Record Producer in the dialog, so thats something I need to figure out.