UI Builder / Asset Management Workspace – How to capture changed fields when using the existing Save

girishbs06
Tera Expert

Hi Community,

I’m working on an Asset Management Workspace / Asset Workspace in ServiceNow and need guidance on handling field changes when the user saves a Hardware Asset record.

Requirement

I have a Hardware Asset (alm_hardware) record opened from a Typeahead search in UI Builder.

The flow is:

Typeahead Asset Tag search → select asset → /record route → Hardware Asset form

The standard Workspace form has the existing Save button.

When a user changes one or more fields, I need the following behavior:

User opens an existing alm_hardware record.

User modifies one or more fields.

The modified values should remain visible in the form.

User clicks the existing Save button.

The record should be saved normally.

After the successful save, I want to display a notification/alert showing which fields were changed, ideally something like:

State: In Use → In Stock

Location: Bangalore → Mumbai

Assigned to: User A → User B

Important requirements

I do not want to create a second Save button.

I want to use the existing Workspace Save action.

I don't want to replace the standard editable form.

The customization should apply only to Asset Management Workspace, not globally to the classic UI or other workspaces.

I need to preserve the normal Save behavior.

What I have investigated

The form is using a Form Controller for alm_hardware.

The Form Controller JSON contains an actionConfigId, and the form's action bar is enabled, so the standard Save button is visible.

I checked UX Form Actions and found generic Save actions, but I don't want to modify the generic Save action because it could affect other tables/workspaces.

I also checked UX Form Action Layouts filtered for alm_hardware, but there is no Hardware-specific Save layout.

I also noticed the Form Controller has events such as:

[Form] Form status changed

[Notification] Add notification requested

My question

What is the recommended ServiceNow-supported approach in UI Builder / Configurable Workspace to:

detect the fields changed in the Workspace form → allow the existing Save action to save normally → after successful save, identify the changed fields/old and new values → display a notification?

Specifically, can this be achieved using:

Form Controller events/status?

A Workspace Client Script?

Declarative Action / UXF Client Action?

An Add-on Event Mapping?

The existing Save action's client script?

Another supported UI Builder mechanism?

I would also appreciate an example of the correct script/API for obtaining the changed fields and their old/new values in a Workspace form.

Thanks!

5 REPLIES 5

Dinesh Chilaka
Mega Sage

@girishbs06 ,

Why can’t we simply use an After Update Business Rule to display an info message on the form, showing the fields that were changed along with their old and new values? Customizing the UI Builder pages can be quite complex.
Thanks,
Dinesh

Thanks for the suggestion. We considered using an After Update Business Rule on alm_hardware, but we have a limitation with this approach.

Our requirement is specifically for the Asset Management Workspace:

User changes fields → clicks the existing Save button → record saves normally → show a Workspace notification containing the fields changed and their old/new values.

The Business Rule can identify changes using current and previous, but the limitation is that it runs server-side for every update to alm_hardware, regardless of whether the update came from Asset Management Workspace, Classic UI, API, integration, import, etc.

We therefore cannot use a Business Rule alone because we need this behavior to be Workspace-specific and need to pass the changed-field information back to the Workspace notification after the existing Save action completes.

Could you please suggest an alternative supported Workspace/UI Builder approach, such as a Workspace Client Script, Form Controller event, Declarative Action/UXF Client Action, Add-on Event Mapping, or another mechanism, that can detect the changed fields and trigger the Workspace notification after Save?

We also need to retain the existing standard Save button and normal save behavior, without modifying the global Save action.

Diogo Ramos
Tera Sage

edited: check my new answer

Hello, 
 
The recommended approach would be to use the activity of the record, it already gives you the functionality you are after (previous vs new values) and it remains there as an audit trail you just need to ensure the fields are being tracked, is there a specific reason this is not sufficient ?

For UIB, I thought about the record watcher data resource here,  but I think as the form reloads this will be useless. Even if you would find a way to display the modal, as the form is reloading that modal would go away (you would have to confirm if it really does go away).
So I think here you actually need a solution that executes on load of the record. It would have to identify the latest update made by that user on the last minute or so and then fetches which values it changed using the historyWalkerAPI or audit table (not recommended). It would need to be a client script that would execute on load and I'm not sure how to make it execute only on that specific workspace, maybe if you extract the current url within the script you can check it from there.

But again these solutions are quite overkill and customized with no guarantee they will work.
I hope it helps either way.





tomasscerba
Mega Sage

Hi @girishbs06 ,

 

Super simple. Comtroller has access ti all field values tou currently have on the form. 

on fiel value change event add client script where you have access to old and new value via event object in client script. Just log the event object and you will see. 

Create state of type json where you will hold changed values. 

then inside client script check what field changed and what is old and new value and store it into you state. 

once user hot save you can trigger another client script which will be on event called, Form Data Fetch Succeeded. And there is whrere you bring your object from state. Loop over it and set info message for each field in that object you have