Change display name on Service Operations workspace landing page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 04:02 PM
Hello all,
I am attempting to update the homepage of the Service Operations Workspace to display the preferred name instead of the first name in the banner that currently says Hello <first name of user>. We have a custom field in the sys user table that stores the preferred name. I've tried to make these changes following the steps by navigating to UI Builder -> Service Operations Workspace -> making a copy of the existing landing page -> adjusting the greeting under client scripts -> Initial Transactions.
However it seems that the first name is captured via client script using < api.context.session.user.firstName > that does not retrieve the preferred name because it's not querying the sys user table.
Is there a way we can query user table so it can pick up preferred name.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 06:35 PM
Hi @Kashif Wasim Sa ,
We had a similar requirement to display the full name. We updated the client script to fetch the full name using <api.context.session.user.fullName>.
Also, it retrieves the current session user's sys_id using <api.context.session.user.sys_id>. You can use this data to query the custom field.
Hope it helps.
Accept and hit Helpful if it helps.
Thank you,
Raghav.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2024 12:05 AM
Hi @Kashif Wasim Sa ,
As you have already explored that "api.context.session.user" does not have all fields available, as suggested by @RaghavMuthyam we may utilize "api.context.session.user.sys_id" to retrieve your custom fields.
To do so you may follow below steps
1. you may create new data broker of type "look_up_a_single_record" and pass Table as "sys_user" and Record as "api.context.session.user.sys_id", which will return all fields in json
2. you can utilize output of this data broker in client script to populate greeting message having custom field value
refer screenshot
Please mark it helpful if it answers your query.
Thanks,
Haseeb Ahmed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2024 02:39 PM
Hi @Haseeb-Ahmed , Thank you for your response. I followed the steps but am having trouble locating the record "api.context.session.user.sys_id". Is there a specific method I should use to find it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2024 06:06 PM
Hi @Kashif Wasim Sa ,
Please go through this document to know how to locate api in UI Builder: https://docs.servicenow.com/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_referenc...