- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
UI Builder Deep Dives Part 3
Overview
- Configuring an existing page
- Creating a custom modal
- Setting up a page handled event
- Creating a declarative action
- Adding a UX Add-On Event Mapping
Thinking Beyond Modals
What are Declarative Actions?
Features
|
UI Action
|
Declarative Action
|
Where They Work
|
Core UI + Workspaces
|
Only in Workspaces & UI Builder
|
Supported Areas
|
Lists, Forms
|
Lists, Forms, Playbooks, Catalog Wizards, Kanban Boards, etc.
|
Implementation Options
|
Client Script, Server Script
|
Client Script, Server Script, UXF Client Action
|
- Client Script – Runs code on the user's browser (e.g., opening multiple records in new tabs).
- Server Script – Runs code on the server (e.g., approving a record by updating a related approval table).
- UXF Client Action – Triggers actions within UI Builder, handled by event handlers (e.g., opening a record in a sub-tab or modal).
Step 1. Open UI Builder
1. In your ServiceNow instance, use the Application Navigator to go to Now Experience Framework > UI Builder.
2. When UI Builder opens, you should see the UI Builder Home screen.
3. Select Experiences Tab at the top of the screen.
Step 2. Configuring an existing Page
1. In the Experience Editor, find Pages and Variants.
Step 3. Creating a Custom Modal
- Component Label: User Related Record
- Component ID:
user_related_record
- Component Label: Related Record Header
- Component ID:
related_record_header
Adding a List Component
related_record_list
'Incident'
and dot walk to Incident → Caller
. @data.record.form.fields.caller_id.value
Requested Item
and dot walk to Requested Item → Requested For. @data.record.form.fields.caller_id.value
Adding a Button Component
- Component Label: Related Button
- Component ID: `related_button`
Step 4. Creating a Handled Event in Body Container
Step 5. Creating a Declarative Action
{
"referenceField": "{{fieldName}}",
"referenceKey": "{{referenceKey}}",
"referenceTable": "{{referenceTable}}",
"fieldLabel": "{{label}}",
"parentTable": "{{tableName}}",
"parentSysId": "{{recordSysId}}",
"encodedRecord": "{{encodedRecord}}",
"serializedChanges": "{{serializedChanges}}",
"fieldType": "{{fieldType}}",
"value": "{{value}}",
"displayValue": "{{displayValue}}",
"dependentField" : "{{dependentField}}",
"dependentValue": "{{dependentValue}}"
}
Incident
.Step 6. Adding a UX Add-On Event Mapping
{
"container": {
"fields": {
"container": {
"encodedRecord": {
"binding": {
"address": [
"encodedRecord"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"label": {
"binding": {
"address": [
"fieldLabel"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"referenceField": {
"binding": {
"address": [
"referenceField"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"referenceKey": {
"binding": {
"address": [
"referenceKey"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"serializedChanges": {
"binding": {
"address": [
"serializedChanges"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"size": {
"type": "JSON_LITERAL",
"value": "md"
},
"sysId": {
"binding": {
"address": [
"parentSysId"
]
},
"type": "EVENT_PAYLOAD_BINDING"
},
"table": {
"binding": {
"address": [
"parentTable"
]
},
"type": "EVENT_PAYLOAD_BINDING"
}
},
"type": "MAP_CONTAINER"
},
"params": {
"type": "JSON_LITERAL",
"value": {}
},
"route": {
"type": "JSON_LITERAL",
"value": "modal_ref_lookup"
},
"size": {
"type": "JSON_LITERAL",
"value": "lg"
}
},
"type": "MAP_CONTAINER"
}
Step 7. Testing and Previewing
Troubleshooting
If at any point something isn't working, try clearing the UI Builder cache.
Within your page variant editor in UI builder, click the hamburger menu icon at the top-left, go to Developer > Clear UI Builder Cache. You can also try clearing your local browser cache.
Conclusion
Congratulations! 🎉 You have successfully created a Field Action Decorator in UI Builder! Big shout out to @dylan_lindgren 's awesome Declarative Actions article. You should check it out if you're looking for a super deep dive in to how Declarative Actions work.
If you found this guide helpful, consider sharing it with peers or teams looking to elevate their UI Builder skills with dynamic actions.
Keep an eye out for future tutorials where we'll dive deeper into crafting immersive, data-driven experiences. Until then-happy designing, and stay curious!
Check out the Next Experience Center of Excellence for more resources
- 2,913 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.