UI Builder - Dismissing Onboarding Modal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 07:28 AM
I am developing a feature on ServiceNow using UI Builder. This feature is a means for dismissal of an onboarding modal. Currently, the modal is set up by calling a client script on page load. This client script uses an api.emit function that points to a guidance. This currently means that every time a user refreshes the page, the onboarding modal is displayed again. This can get very annoying. We want the modal to display once on page load and never again. How can we capture the information whether a specific user has seen the onboarding modal or not?
I realise that the GlideRecord api cannot be used in UI Builder, as well as any server side apis or script includes... I can't figure out how this is done all within UI Builder. Guided tours and other modals display on other workspaces and when new features are released so it MUST be possible, but I would really appreciate some help on how this is done. Thanks all!
- Labels:
-
UI Builder : Next Experience

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2025 02:30 PM
You may need to create a new data resource to create and manage the user preference. For the condition you could either use a formula or just handle the if statement in the client script you're calling (probably the easier method).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2025 03:15 AM
I've figured out how to use the create record data resource to create a user preference, however I am having the problem of the 'user' field not being populated:
This is the script to create the preference:
var userName = api.context.session.user.sys_id;
api.data.create_record_1.execute({
table: 'sys_user_preference',
templateFields: 'name=bcwOnboardingModal^type=string^value=true^user=userName',
useSetDisplayValue: null,
I'm not sure what user.____ property I should be using to populate this field. Can you help with this please?
I think if I can get this working, creating a unique user preference for each user then I can look these up base the client script for the modal on this preference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2025 08:05 AM
As explained above, there is a client script running on page load/ready that emits a modal.
I first started trying to use client state parameters as the condition for this client script running. I created a parameter showOnboardingModal and set it as the condition of the client script executing. Manually changing the default value of the client state parameter is effective to stop the modal but I believe the client state parameter resets to default on page refresh (can you confirm please?) so I realised using these as a condition would not work.
Essentially, on page ready, I want the system to look for a user preference regarding this. If it doesn't find one, I want the modal to emit with that client script. Then I want a user preference to be created so next time the page loads, the modal is not emitted.
But my problem is using the data resources...
I don't have a 'create user preference' data resource:
And the create record data resource does not have the option to create a record on the user preferences table:
Then after the user preference is created, how do I make it so the client script runs when it doesn't find the user preference?
So !condition instead?
Also am I correct in just running these all on page load?
Thanks in advance, I've really got myself confused with all this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2025 08:06 AM
As explained above, there is a client script running on page load/ready that emits a modal.
I first started trying to use client state parameters as the condition for this client script running. I created a parameter showOnboardingModal and set it as the condition of the client script executing. Manually changing the default value of the client state parameter is effective to stop the modal but I believe the client state parameter resets to default on page refresh (can you confirm please?) so I realised using these as a condition would not work.
Essentially, on page ready, I want the system to look for a user preference regarding this. If it doesn't find one, I want the modal to emit with that client script. Then I want a user preference to be created so next time the page loads, the modal is not emitted.
But my problem is using the data resources...
I don't have a 'create user preference' data resource:
And the create record data resource does not have the option to create a record on the user preferences table:
Then after the user preference is created, how do I make it so the client script runs when it doesn't find the user preference?
So !condition instead?