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
‎09-06-2024 04:20 AM - edited ‎09-06-2024 04:21 AM
Hi @Kashif Wasim Sa ,
If you have your custom field with name xyz in sys_user table then you have to use - api.data.look_up_a_single_record_1.result.xyz.value
Please try to debug further
1. you may log result using console.log(api.data.look_up_a_single_record_1.result)/console.log(JSON.stringify(api.data.look_up_a_single_record_1.result)), to see what all fields you are getting, so you can use the required ones
2. you have to write above line of code in client script, and you can check logs in chrome debugger tool console in runtime
Please accept solution and/or 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-23-2024 05:54 AM
However, here's a general approach:
Identify the Client Script: Determine the exact client script that's displaying the first name in the banner.
Modify the Script: Within the script, replace api.context.session.user.firstName with a GlideRecord query to the sys_user table, filtering by the current user's sys_id and retrieving the preferred name field.
Update the Banner: Use the retrieved preferred name to update the banner text.