Configuring Declarative Actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 08:13 AM
How do you create a List UI Action in the Service Operations Workspace that cancels multiple selected incidents?
The Declarative Action framework is used to integrate Core UI behaviours such as client actions or server scripts into Workspace forms, fields, lists, and related lists without the need to edit code. Declarative actions are similar to platform UI Actions to add buttons on a form. By using Declarative Actions and not adding buttons to a page in UI Builder, you are making your upgrade experience better as Declarative Actions do not customize an OOTB UI Builder page. This article walks through a simple use case of creating a Cancel Incidents action to a List and will serve as a resource document for various attributes related to Declarative Actions.
Server Script
A simple server script that is going to allow a user to cancel selected incidents from the list view. To create the declarative action navigate to
Now Experience Framework > Actions and Events > Action Bar Declarative Actions.
The Workspace field should be left blank when creating declarative actions for Configurable Workspace, this field is only applicable to Agent/legacy workspace. Declarative actions can be made global or specific to a workspace.
Most of the fields discussed in the section above are going to be in the Advanced View of the form. The following will be configured:
Requires write access is true
Server script:
var state = current.getValue('state'); // Get the current incident state.
if (state === '1' || state === '2' || state === '3') // Check if the incident is in a cancelable state.
{
current.setValue('state', '8'); // Set the incident state to canceled.
current.work_notes = 'Incident canceled'; // Add a comment to the incident record.
current.update(); // Update the incident record.
}
After clicking on Cancel Incidents:
- 1,375 Views