showQuickForm(): How exactly does it work and why it is essentially undocumented?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2018 09:08 AM
I am trying to solve the ever-popular "how can my users resolve multiple incidents while filling in multiple required fields in one step" problem.
The best I seem to be able to do is to create a UI Action using "showQuickForm" to pop up a dialog, and then (because no Client Scripts or UI Policies apply to these dialogs) relying on Data Policies to inform the user after the fact if they've failed to fill out the form properly. This is unfortunate because I have one field that is conditional on the value in another field, and I have no "nice" way to present or enforce that.
In any case, I am a bit confused as to how the showQuickForm function actually works. I have not been able to find any "official" documentation on it, except by way of it being referenced in an example:
ServiceNow (London): Create a UI action to close multiple incidents
This example says that the first argument is the UI View to be used to generate the form, and that the second argument is the name of a Business Rule.
However, the de facto authority on this functionality seems to be a servicenowguru.com article from 2010 (!): GlideDialogWindow: QuickForms
Here, Mark Stanger says that the second argument should be the "Action Name" of the UI Action used to invoke the dialog in the first place. I followed his instructions and it works, but...
...what exactly is going on here? Do I need to worry about a "name collision" with another UI Action? With a Business Rule? Does it look at both? Are the ServiceNow docs wrong?
The way this appears to work is that showQuickForm pulls up a dialog using a specific "view," and then when the form is submitted, it sets the values from the form on each selected record, and then...I think it executes the "Script" of the UI Action named in the second argument once for each selected record. (Hence the need to put "current.update();" in the script.)
tl;dr - This seems to be a popular and widely-cited feature in the platform, but I can't find any official documentation and I'm worried about unintentional side-effects or interactions. Can anyone here provide some definitive information about what it actually does and doesn't do "behind the scenes," and how the arguments are interpreted?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2018 07:44 PM
So any function that is client side can be read.
Here's what I see as the function's contents;
https://gitlab.com/jacebenson/sndocs/blob/master/sources/kingston/3a/scripts/context_actions.js#L99
You can look at this on your own instance at the relative path of /scripts/context_actions.js
Now that code looks like this when indented;
function showQuickForm(id, action, width, height) {
var form;
var tableName;
var srcElement;
var keyset;
if (window.lastEvent) {
srcElement = getSrcElement(window.lastEvent);
form = srcElement.form;
if (srcElement.tagName == "SELECT") {
var o = srcElement.options[srcElement.selectedIndex];
tableName = o.getAttribute("table");
} else
tableName = srcElement.getAttribute("table");
if ((action == undefined || action == '') && srcElement.value)
action = srcElement.value;
if (!form)
keyset = g_list.getChecked();
else
keyset = getChecked(form);
window.lastEvent = null;
}
if (tableName == undefined) {
if (typeof(gcm) == 'undefined')
gcm = crumbMenu;
tableName = gcm.getTableName();
form = getFormForList(tableName);
if (typeof(rowSysId) != 'undefined')
keyset = rowSysId;
else
keyset = getChecked(form);
gcm.setFiringObject();
}
if ((!form && !tableName) || (!tableName && g_list))
return;
if (!keyset || keyset == '') {
alert("No records selected");
return;
}
var gForm = new GlideDialogForm("", tableName + "_update");
if (width && height)
gForm.setDialogSize(width, height);
gForm.addParm('sysparm_view', id);
gForm.setMultiple(form);
gForm.addParm('sysparm_checked_items', "sys_idIN" + keyset);
if (action && action != '')
gForm.addParm('sysparm_action_name', action);
gForm.render();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 11:04 AM
Thanks, Jace! That repository is a great resource.
From looking at the code, I can see that the arguments are:
showQuickForm(id, action, width, height)
The id is, of course, the view id. The name "action" rather strongly implies that this is a UI Action name (as I suspected) and not a Business Rule, though ultimately it goes to sysparm_action_name as a hidden field on the dialog, and I can't find any info on exactly how that is resolved, and how conflicts may arise or could be avoided.
It also looks like this is pulling up the incident_update.do (or {whichever table}_update.do) form in a GlideDialogForm and applying the specified view to it.
It makes me wonder if I could get a more full-featured form (with client side capabilities, marked mandatory fields, etc) if I constructed a redirect to incident_update.do with the proper query string, essentially getting the same functionality as the dialog, but with all of the niceties we expect on a proper form.
I wouldn't say that all of my questions are answered, but this was very helpful! I made do with showQuickForm last week, but perhaps with this knowledge and some trial and error I could come up with something a little nicer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 11:09 AM
Awesome, if you do, just please share what you make. No reason to keep your great work hidden 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2019 04:24 AM
Hello Dear,
I have question regarding showQuickForm using for multi record closing. As per servicenow documentation this is for closing multiple Incident records, can we use this for any other table as well.
If I have to close multiple records of custom application using showQuickForm as onclick. I have facing one issue, as soon as I create UI action using showQuickForm, the related list keep loading.
Thanks.