Pass client state parameter between pages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi community,
Question: how do you guys pass data from workspace page to another? From page 01 to page 02. Looking for advices.
- URL parameter and store in table record are out of requirements.
- Call the same rest APIs endpoints on page 02 are increasing the bills.
User journey: After end user review the information and click next button will be redirected to page 02 and in that case I'd like transfer some client state parameter data from page 01 to page 02 avoiding call the REST APIs again .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Henrique Costa ,
You can use event mapping and page parameters within the ServiceNow UI Builder workspace framework is the most aligned . It avoids database storage, URL parameters, and redundant API calls, facilitating smooth client state transfer between pages during navigation.
Sandeep Dutta
Please mark the answer correct & Helpful, if i could help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Henrique,
When you mention one page to the other, are we talking about different record pages, completely different pages, subpages ?
Normally the way to go is to pass parameters in url as already mentioned(I have done this multiple times personally). If in your use case you cannot do this, you won't have many choices that are as straight forward.
If it would be a subpage I think you can just bind the parameter as input for the child page.
There is also the situation where you can just trigger the second page via a declarative action. On the Specify client action record payload you can pass the data that you need although here I normally only used data saved on the record (although you seem to be able to use g_form). Then one would use a handled event on the second page to do whatever needs to be done, connecting the action to the event.
Have you looked at playbooks? Could that not solve your issue ?
Either way, the only thing I can think right now is that you store those client parameters of Page 1 into the session of the user using the GlideSession API (since you don't want to store it in the record) via a transform data resource, and then on Page 2 you would have another resource that gets those session elements that you stored to be used on what you need, then once that page is closed you clear out the session elements.
This is a bit of a workaround solution review how much data you need to put there and for how long so you are not creating any unwanted session problems.
Maybe there is also a way to add/retrieve data from UIB cache, but I am not aware of it.
I hope this helps 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @Henrique Costa ,
you have just crossed 2 only ways that are available to transfer the data between pages :). Second one is not really transferring but rather storing and querying.
Optional URL parameters are the most common and I think the only way how to smoothly transfer data between pages in UI builder without creating any overhead records.
Even if you would create a viewport to open page within your page, you only pass the data there thru mandatory or optional parameters of that page.