Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to dynamically change the display name of the list header

LimingWu
Tera Contributor

I got a question that if it is possible to dynamically change the display name of the list header in workspace.

LimingWu_0-1788837852753.png

For example, the screenshot above has State field and the value contains Successful and Failed. When I filter Successful, the header Vulnerability Status changes to Vulnerability Result as the display name. When I filter Failed, the header Vulnerability Status changes to Root Cause as the display name. 

Has anyone handled this kind of request before? If you did, could you kindly share your experience please? Thanks a lot.

2 REPLIES 2

musislam
Kilo Sage

Hi Liming,

 

Short answer: not out of the box. In workspace the column header comes from the field label (sys_dictionary / sys_documentation), and the list component just renders that - it has no awareness of what filter is currently applied, so there's no config switch that says "when State = Failed, call this column Root Cause".

 

A few ways people usually handle this instead:

 

1. Separate lists per state. Create two saved list views / list menu entries (Successful, Failed) each with its own fixed filter, and rather than re-labelling the same field, expose two different fields (or two calculated / display fields) that carry the right label. This is the cleanest from a maintenance point of view and users still feel like they're clicking one list.

 

2. Different list views with label overrides. You can override a field label per view (sys_documentation with the view set), so a "failed" view of the operational vulnerability list could show Vulnerability Status as Root Cause. The catch is that the view is chosen when the list is opened, not when the filter changes.

 

3. Custom list in UI Builder. If it really has to react live to the filter, build the list on a UI Builder page with a data resource whose query is bound to a state control, and set the column labels through a client script / property that reads the same state. That gives you full control but it's a custom component you'll need to maintain through upgrades.

 

From your screenshot this is the Operational Resilience Workspace (Operational vulnerability - All operational vulnerabilities list), which is a UI Builder based workspace, so option 3 is technically possible there - but before going that way I'd check with the business whether the real need is "different labels" or actually "different columns for different outcomes". In most cases I've seen, option 1 solved it with far less effort.

 

Which release are you on? Happy to be more specific.

Macki | Deloitte AU | Engineer Lead

Ankur Bawiskar
Tera Patron

@LimingWu 

that's out of the box behavior.

Please inform customer about this

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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