Remove State from Change Request Flow from Service Operations Workspace

ponranjitha
Tera Contributor

Hi,

 

 

We would like to remove custom states from the Change Request form in Service Operations Workspace. However, we cannot deactivate these state choices as it would impact existing change records. We attempted to modify the Data Broker server script “Change Model States” by adding a condition to exclude those choices, but it did not work. Could you please assist us with this?

 

ponranjitha_1-1779100627078.png

 

1 ACCEPTED SOLUTION

Hi @ponranjitha 

From your screenshot, the Stepper component in UI Builder is not hard‑coded—its Items property is bound to:

Items → stepperData > steps

So you cannot remove steps directly on the Stepper UI.
You must remove/filter the unwanted items from the data array (stepperData.steps) that feeds the stepper.

Below are the best ways to do it (choose based on how your steps are coming).

1) Remove steps by filtering the data (Most common / recommended)
Where to do it
Go to Data and scripts (left bottom panel) → find the data resource / client script that builds stepperData.

Usually it is one of these:

a Client Script that sets stepperData.steps
a Transform / Map script for the data resource
a Scripted data resource returning the steps
What to do
Filter out steps you don’t want (example: remove Review and Canceled).

Example (Client Script / Transform Script)


// stepperData.steps = [{ id: 'new', label: 'New' }, ...]

 

// Remove specific steps by id (recommended)

const removeIds = ['review', 'canceled'];

 

stepperData.steps = (stepperData.steps || []).filter(s => !removeIds.includes(s.id));

 

This will immediately remove those choices from the stepper because the Stepper only renders what exists in steps.

2) Remove steps based on the record’s state model (If steps come from Change state flow)
In Change/Workspace implementations, steps are often generated from state values (e.g., new, assess, authorize, scheduled, implement, review, closed, canceled).

So you can filter using value / state instead of id.

 

const removeStates = ['review', 'canceled'];

 

stepperData.steps = (stepperData.steps || []).filter(s => !removeStates.includes(s.value));

 

Tip: check what your step objects look like (id/value/label) by logging them in a client script.

3) Don’t delete steps — hide them conditionally (Role / condition based)
If you want steps visible only for certain users/roles or conditions:

 

const isAdmin = (gs.getUser().hasRole('admin')); // server side only

// In UI Builder client side you typically use user roles from session/user profile data.

 

stepperData.steps = (stepperData.steps || []).filter(step => {

  if (!isAdmin && step.id === 'canceled') return false;

  return true;

});

 

 

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@ponranjitha 

somewhat challenging to implement this in SOW

But what's the point in hiding those from Process flow if you are using the state values?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader