UI Builder - Dismissing Onboarding Modal

SomaP
Tera Contributor

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!

8 REPLIES 8

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could use a guided tour, but if you want to it all within UIB you can use a create record or update record data resource to set a server value. You could also write a custom transform data resource to call a script include.

Hi Brad, thank you for taking the time to reply, and in theory I understand how a create user preference data resource works, but I am struggling with the implementation. Is there an example you could refer me to that I could learn from please? 

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Sure, what have you tried so far and what issues are you running into? Screenshots are helpful.

I've tried so many things that I am getting myself confused and going in circles so let me try to explain.

I've tried to execute the client script for the onboarding modal with a condition of a client state parameter. I created this parameter with a name of showOnboardingModal. Manually changing the default value of the client state parameter is effective in controlling the onboarding modal but then I couldn't dynamically (per user) capture a change to the client state parameter. I think the client state parameter resets to default after refresh? 

So this lead me down the road of trying to create a user preference in the sys_user_preference table with a Boolean value to show or not show the onboarding modal. 

 

Essentially, I want this client script to check if the user has a preference with the name showOnboardingModal and run (emit this onboarding modal) on the condition that there isn't a user preference present. 

I then want the user preference to be created and stored so it only shows once per user.

 

I think my problem is that I don't fully understand how to create this user preference, or how to use the look up to check for it. 

 

My first problem is that there isn't a create user preference data resource: 

SomaP_0-1740495853227.png

I tried to use the create record data resource but that doesn't allow me to create a record on the user preference table: 

SomaP_2-1740497153547.png

So I would love to know 
1. How to configure these data resources to create and look for this user preference?

2. To execute the client script conditionally based on the user preference, do I just add a condition to its execution like I did with the client state parameter but instead on a look up data resource like: 

SomaP_3-1740498046374.png

How can I make this trigger only when !condition instead? 

 

I'm sorry if this is confusing, as I said I've confused myself haha...