GlideDialogForm and GlideDialogWindow

oharel
Kilo Sage

Hi,

On the incident form, I am using a UI action to call a glideDialogForm from another table.

Currently using this script:

//dialog opens with previous justification and deletes it on submit

  if(lookup.u_category != '') {

  var dialog = new GlideDialogForm('Escalate incident', 'u_incident_category_area_lookup', setCatField);

  dialog.setSysID('-1'); //Pass in -1 to create a new record

  dialog.addParm('sysparm_query','u_incident='+inc + '^u_category='+category + '^u_area='+area + '^priority='+priority + '^u_work_notes='+workNotes); //Set form sys id and other fields in lookup form fields

  dialog.addParm('sysparm_view', 'popup_view'); //Specify a form view

  dialog.addParm('sysparm_form_only', 'false'); //Show related lists

// dialog.removeCloseDecoration(); //remove the close cross from the dialogwindow

  dialog.render(); //Open the dialog

  }

  }

target table is u_incident_category_area_lookup

A coupe of issues I encountered:

1. dialog.addParm('sysparm_form_only', 'false');   -> does not work. The related list on the target table does not show in the window that pops up.

2. How do I add a "Cancel" button to the pop up form?

I wanted to use a glideDialogWindow, but could not understand how to create a UI Page that refers to the target table and get the form to load properly - so any help/example would be very welcome.

harel

6 REPLIES 6

Bharath40
Giga Guru

Hi Harel,



I found this article ui action cancel with glide dialog window so helpful along with the servicenow wiki Displaying a Custom Dialog - ServiceNow Wiki .


Hi bharath_kumar,



Thanks; however, I am using GlideDialogForm, not GlideDialogWindow.


Harel


James Hammond
Giga Guru

Hi



When you create a new record on a table, you don't have access to related lists; Line 4 of your code explicitly states you are creating a new record, which explains why the property in Line 7 has no effect.



Popup forms don't normally need Cancel buttons, as you would use the close button in the top right hand corner.


Hi James,



Thanks for your insights.


You are correct, however, commenting out line 04 does not change the behavior. I tried it with both related lists and with embedded lists. It does not work for the related lists, but it does for embedded lists.


The record on 'u_incident_category_area_lookup' already exists when the glideDialogForm is created. The pop up form shows the record after it has been created, but not the related list. It does, however, show it as an embedded list. For new records - I agree: related lists do not exist until the record is saved, but this is not the case. What the glideDialogForm does is show an already existing record - otherwise why is it showing the embedded but not the related list?


As for the close / cancel button - I know, that's why I asked...



harel