Add modeless dialog to a UI Builder page
Learn how to add a modeless dialog in UI Builder. A modeless dialog is a floating window containing content above a page.
Before you begin
Role required: ui_builder_admin
The following steps walk you through the process of configuring a button to open a modeless dialog containing the Attachments component.
Note:
The procedure outlined here is just one example of how to use modeless dialogs.
There are infinite possibilities. Add and configure modeless dialogs to meet your business needs.
Procedure
- Navigate to All > Now Experience Framework > UI Builder.
-
Open an experience to work in or create an experience by selecting Create > Experience.
See Configure how users interact with your applications in UI Builder for more information on creating experiences.
-
Open or create a page variant.
For more information about how to create a page in UI Builder, see Create a page in UI Builder.
-
In the content tree, move your mouse to Modeless dialogs, select the + icon, and select the Modeless dialog component.
- If the modeless dialog doesn't appear on the stage automatically, select the new modeless dialog named Modeless dialog default in the content tree.
-
In the configuration panel Configure tab, view the presets that were added automatically with the modeless dialog, for example, the width, height, position, and enable drag setting.
All of these preset properties can be edited, if necessary.
Note:For more information about Modeless Dialogs advanced properties, see the ServiceNow Developer site. -
In the data resources drawer, the Modeless dialog controller was added automatically.
- In the content tree, select + Add content under Modeless dialog default > actions to add content to the modeless dialog header.
- Search for and select the Stylized text component.
-
In the Stylized text configuration panel, select None to configure the component manually.
If the Record subheading preset was automatically added, select the drop-down arrow, select None, and select Remove on the Configure tab.
- If not open already, select Configure to open the configure tab.
-
In Text, remove the sample text and type Add Attachments.
- Select Save in the UI Builder header.
- In the content tree, select + Add content under Modeless dialog default > content > Container to add content to the modeless dialog body.
- Select the Attachments component.
-
In the Attachments configuration panel, if not selected already, select Record attachments and Apply to configure the component with a preset.
For more information about configuring the Attachments component, see the ServiceNow Developer site.
- You could add content to the modeless dialog footer, but in this example leave the footer empty.
-
Select Save.
Notice in the content tree that the modeless dialog and all of its components are listed above the Body of your page structure. Also, the Minimized dialogs dropdown component is added to the page automatically (and is listed under the Body in the content tree) to provide the functionality for the minimize icon in the modeless dialog header.
- In the content tree, select Body.
-
Add a button component and configure it to open the modeless dialog.
- In the content tree, select the Menu icon next to Body and select Add content.
-
On the Layouts tab, select Single column.
A new column layout containing a single column is added to the bottom of the page.
-
On the stage, select the + icon in the new column layout.
-
Search for and select the Button bare component.
- In the configuration panel, on the Configure tab, select None to configure the component manually.
- Select the Events tab in the configuration panel.
-
Select + Add event handler.
- In the list at left, select Open Modeless dialog (you may need to scroll down in the list).
- Type Attachments in Minimized Heading.
-
Select Modeless dialog default in Modeless dialog.
There are other options that can be configured here, including a heading and a category.
-
Select Add.
- Select the Configure tab.
-
Type Add Attachments in Label.
- Select Save.
- Select the drop-down arrow next to Preview in the UI Builder header and select Open URL path in the list.
-
Select the Add Attachments button to test the modeless dialog.
The modeless dialog opens above the main page with the heading at the top and the Attachments component below.
-
To test the minimize functionality, select the minimize icon on the modeless dialog.
The modeless dialog is minimized and can be accessed from the Minimized dialogs drop down.
-
Select the minimized dialogs icon and then select Attachments to open the modeless dialog window again.