GlideDialogWindow: Popup Record List
https://www.servicenowguru.com/system-ui/glidedialogwindow_popup_record_list/
‘ve been meaning to write about the different kinds of Glide popups available in Service-now for a while but haven’t really figured out a good way to show all of the different pieces that make them work. Instead of putting all of the information in one article I’ve decided to publish 2 or 3 different articles showing some of the different things I’ve done in the past. Look for more articles on Glide popup windows in the future. If you want to see all of the articles I’ve written about GlideDialogWindow and popups in Service-now just use the tags at the bottom of this article.
This article shows how you can pop open a list of records in Service-now using a couple of different methods. It also shows you how you could use a UI Macro icon to invoke either of these popup types.
The following scripts can be called anywhere where you can use client-side JavaScript. Most often these would probably be called from a UI Action with the ‘Client’ checkbox checked.
This first example shows how to pop open a list of major incidents in a GlideDialog window.
//Show Major Incidents in a GlideDialog popup window function showMajorIncidents() { //Initialize the GlideDialog window var w = new GlideDialogWindow('show_list'); w.setTitle('Major Incidents'); w.setPreference('table', 'incident_list'); w.setPreference('sysparm_view', 'default'); //Set the query for the list var num = g_form.getValue('number'); var query = 'active=true^priority=1^number!=' + num; w.setPreference('sysparm_query', query); //Open the popup w.render(); }
You can also size any ‘GlideDialogWindow’ object by using the ‘setSize(WIDTH,HEIGHT)’, ‘setWidth(WIDTH)’, and ‘setHeight(HEIGHT)’ methods. For example, to set the width of the dialog above to 600 pixels, I could add ‘w.setWidth(600);’ at any point before rendering the dialog.
In some cases it may be necessary to open the popup in a separate window completely. This script opens a regular popup window containing a list of major incidents.
//Show Major Incidents in a Popup Window function showMajorIncidents() { //Construct a URL for our popup window var num = g_form.getValue('number'); var tableName = 'incident'; var url = tableName + '_list.do?'; url += 'sysparm_query=active=true^priority=1^number!=' + num; //Open the popup var w = getTopWindow(); w.popupOpenFocus(url, 'related_list', 950, 700, '', false, false); }
You can also use these functions in UI Macros. Here’s an example that pops open a window displaying high-priority incidents currently open for the selected CI. The script would need to be put in a UI Macro and that macro would need to be added to the ‘cmdb_ci’ field.
UI Macros are associated to reference fields by using the ‘ref_contributions’ attribute on the dictionary entry for that reference field. So if I named this UI Macro ‘show_ci_incidents’ then I could add the macro to the reference field by adding ‘ref_contributions=show_ci_incidents’ as a dictionary attribute for the field. If I have more than one macro I need to add to a reference field I can add them by separating them with a semicolon like this… ‘ref_contributions=show_ci_incidents;macro_2;macro_3’
CLICK HERE if you need to see how to add a macro to a non-reference field.
<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <j2:if test="$[current.getTableName() == 'incident']">; <j:set var="jvar_n" value="show_major_incidents_${ref}"/> <g:reference_decoration id="${jvar_n}" field="${ref}" onclick="showCIIncidents('${ref}')" title="${gs.getMessage('Show major incidents')}" image="images/warning.gifx"/> </j2:if> <script> function showCIIncidents(reference) { //Get the name of the field referenced by this macro var s = reference.split('.'); var referenceField = s[1]; //Get the value of the reference field var v = g_form.getValue(referenceField); //Initialize the dialog window var w = new GlideDialogWindow('show_list'); w.setTitle('Major Incidents'); w.setPreference('table', 'incident_list'); w.setPreference('sysparm_view', 'default'); //Set the query for the list var num = g_form.getValue('number'); var query = 'active=true^priority=1^number!=' + num + '^' + referenceField + '=' + v; w.setPreference('sysparm_query', query); //Open the popup w.render(); } </script> </j:jelly>
- Material Dialog,SwipeRefreshLayout,ListPopupWindow,PopupMenu
- Android开发笔记(一百二十一)列表弹窗PopupMenu和ListPopupWindow
- 【原创】相对完美的垂直居中popup(modal/dialog),无需监听window.resize事件
- 转:32 Best JQuery Popup Window Dialog Box Example
- Android控件之TimePickerDialog、DatePickerDialog和自定义DialogPopupWindow与NotificationManager
- android 对话弹出框(Dialog AlertDialog PopupWindow)
- ListPopupWindow
- EditText+ListPopupWindow实现可编辑的下拉列表
- Material Dialog,SwipeRefreshLayout,ListPopupWindow,PopupMenu
- Android EditText+ListPopupWindow实现可编辑的下拉列表
- ListPopupWindow Overly透明遮罩效果
- ListPopupWindow用法
- Android开发笔记(一百二十一)列表弹窗PopupMenu和ListPopupWindow
- Modal Popup Dialog Window in ASP.NET 传递多个参数
- tag, dialog,popupwindow intent-filter的使用
- Android的对话框常用的有两种:PopupWindow和Dialog。
- 0104 wrrkmigua ListPopupWindow的使用
- Android PopupWindow Dialog 关于 is your activity running 崩溃详解
- ListPopupWindow,PopupMenu
- Android Material Design:ListPopupWindow