Workspace Experience: Declarative Actions Part 2

Updated: Apr 1




This is a continuation from my last post on Declarative Actions, in Part 1 I looked at a Related List Action that can be used on the Record View in Agent Workspace. For this post, I'll continue on looking at the different action types and touch base on some important fields along the way. For a summary of Declarative Actions, see the post I linked above.


List Actions


List Actions apply to the list view of a workspace, not to be confused with Related Lists which I touched base on in Part 1. The most common List Actions are ones such as New or Edit. List Actions can also be used to perform actions such as assigning records, and batch updating or deleting records.


Note: The Edit list action pulls up a side panel that shows the Workspace view of a record. To my knowledge this cannot be changed or defined, but I would love to know if it can. This is similar to checking multiple records in a list view in the Platform, and choosing Update Selected from the List Context Menu. In the platform the Update Selected/Update All form either displays the Default view or the view of the user (i.e. in user preferences) but the workspace doesn't seem to replicate this functionality and points to the Workspace view always.


For this post, I'm going to create a List Action that re-opens an Incident when it is closed.


Like I mentioned previously, ServiceNow made it super easy to make sure you're accessing and creating the correct Action Model by creating modules, For List Actions the module is Workspace Experience > Actions & Components > List Actions.



A couple of things to point out here, If you put [{{count}}] in your Action Label it will show a real time count of the number of records that are selected in the list. I provided an Action name (think UI Action names) and I'll reiterate we probably don't want duplicate Action names for buttons. I'm going to run this server-side so it's Implemented As: Server Script, I just played around with Button type, this is where the button coloring comes from, limited the action to Agent Workspace, and put it in the Global Now Actions group so that it would be under Edit. I also put it on the Global table because I wanted to play around with conditions some.


I'm still trying to get the hang of what type of condition to use when, as it seems to me that conditions are applicable to different Action Models but they seem to show up on all Action Models and the tool tips leave something to be desired. Since I put this as a global action I want to limit it to only the Incident table so I put a Script Condition of:

current.getTableName() === "incident"

I couldn't find a way to limit the button to only show for Closed incidents, and there's probably not a way to do this since the system wouldn't really know the state(s) unless the record is checked. I do wish there was a feature and perhaps there is, to get the list query so I do could do something like 'Only show this if the list only shows closed incidents'. I did notice that on the out-of-the-box Workspace List 'Assigned to me' for Incident that the Assign to Me button shows there so this seems to be an all or nothing thing at the moment, but I hope to find ways to refine this as it could be confusing to users.



I also checked Required write access since I only want users who can actually write to the record to be able to perform the action.



Finally I added a Confirmation Message because I really like this feature, especially when users are performing actions like changing record states.



I really wish we could put the Incident numbers or at least the count of the number in the confirmation message, but it seems to be a string at the moment. Also it seems like gs.addInfoMessage and gs.addErrorMessage is not supported for List Actions using server scripts in workspace as well. I doubled checked with the Assign to Me function because that seems like a great candidate to display a message but it just performs the action on the server and reloads the list.


Finally, I added this script to the Server Script field to check to see if the record is valid, and if so then check to see if the state is closed, if so then update it to new, and if not then don't and return. While I can't tell the user is happening at least here's some background checking to not attempt to re-open records that are not in a closed state.

(function reopenInc() {
    if (!current.isValidRecord()) {
        gs.info('Reopen Workspace: Invalid record');
    }

    if (current.state == 7) {
        current.active = true;
        current.state = 2; //In Progress
        current.update();
		gs.info('Reopen Workspace: Is Valid and Closed');
    } else {
		gs.info('Reopen Workspace: Is Valid but not Closed');
		return;
	}

})();

Here's what it looks like in Agent Workspace:






Field Decorators


For fun, I created a new Action Assignment using the Open URL client action in the Specify client action field. There's only one attribute for this client action called 'url' which I defined in the Action Attributes > Payload Map field as https://developer.servicenow.com/


Here's some screenshots:




In my workspace the field decorator shows as the icon I chose, and when I click it opens the developer site in a new tab.




Contextual Side Panel


You can create your own components to go here. I created a previous article on the trickery between CSM workspace/global components in the Contextual Side Panel, where I tried to remove Agent Assist, etc. from a scoped workspace.


Navigate to Workspace Experience > Action & Components > Contextual Side Panel and you'll see all of the OOTB stuff. Notice the existing records have the Action Model of Form.


Without jumping into creating a custom component, aside from Agent Assist/Templates the HR components look interesting, such as At A Glance and Fulfillment Instructions. I could see the Fulfillment Instructions functionality being ported over to ITSM, perhaps something like Escalation Instructions based upon Business Service.



Looking at the Action Assignment HR Case Instructions, a field I want to point out is the Model Fields required which will pass to the component payload as properties.




Form Related Item


Related Items appear like tabs above them form pane, between Details and other related lists. An example is the Install Base Related Item on the Account form. A Related Item isn't a Related List, it's something you define as related to the record, without configuring it as a related list in the Workspace (or other) view.


Navigate to Workspace Experience > Actions & Components > Related Items. Related Items do require a component, there are some ServiceNow has provided out of the box, but for general purposes custom components will probably need to be created here. Ensure the Form position field is set to Related Item (you may need to set this in the list view)


For this example, I had some fun playing around in the Customer Information related tab. Out-of-the-box the Interaction record has a wealth of information about an associated Contact or Consumer, which I think could really be helpful on other CSM related records, or scoped records extended from CSM tables. Here's a screenshot of of the Related Item - Customer Information:



There is a lot in the Customer Central app, which I wont get into here, but it's worth checking out. For my purposes I'm going to copy two of the cards normally associated with Interactions, and point them towards my Scoped Orders records which has been extended from Case. I then performed an Insert and Stay on the Interactions sn_customercentral_cust_info_config and pointed it to my Scoped Orders table. I created two records in the Customer Information Cards sn_customercentral_record_config related list, one for Contact and one for High Priority Cases.


The Customer Information Related Item now appears under my Scoped Order record view, and I can see the associated Customer Information Cards I created:



I think the Customer Information tab is really neat, and am interested in what else can be done with it, or solutions with other records (ITOM?) being applied to ITSM tables.



Resources


ServiceNow Product Documentation: Customizing Workspace


ServiceNow Product Documentation: Create a List Action


ServiceNow Product Documentation: Set up custom actions on record fields in Workspace


ServiceNow Product Documentation: Create a related item in Related Items


ServiceNow Product Documentation: Add custom components to the Contextual Side Panel

296 views1 comment

Recent Posts

See All