Catalog Item in Workspace Prefills Old Record Data When Opened from Different Records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
We are opening a Record Producer from an agent record in the Configurable Workspace using a client-side UI Action.
The parent record sys_id of the agent is being passed and used in the on load client script in the record producer to prefill a variable (user) in it.
The issue is that when the record producer tab remains open, and we navigate to another agent and trigger the same action again, the previously populated sys_id is retained rather than being refreshed with the new record’s sys_id and the same tab is being opened.
We are currently using client-side parameter passing and local storage to transfer the sys_id.
Has anyone implemented a reliable way to pass parent record context to a catalog item in Configurable Workspace without stale data issues?
Or the problem is in how we are opening the Record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I tried this also, it still opens the same tab @Vaibhav Chouhan & @Ankur Bawiskar.
Thanks for the suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
that's what I asked @Vaibhav Chouhan to share screenshots if that approach is tried by him
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Vaibhav Chouhan, I tried this g_aw.openRecord() also and took the sys_id from the url same as you mentioned, but it still didn't work.
Please help us with the screenshots, as it will be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14m ago
Hi @Nirma Sai E @Ankur Bawiskar ,
Yeah, I tested it more after your message and you’re right, just using g_aw.openRecord() and reading the sys_id from the URL doesn’t fully fix it.
The real issue is that Workspace reuses the same Record Producer tab if it’s already open. So even though the URL changes, the component itself doesn’t reload, and the onLoad script only runs the first time. That’s why the old value stays.
So it’s not really a parameter passing issue , it’s how Workspace handles tab reuse.
What worked for me was not relying only on onLoad, but instead watching for URL changes and updating the field when the parent_sys_id changes. Since Workspace updates the route but keeps the component alive, we need to handle that manually.
Something like this, this script checks the URL every 500 milliseconds and updates the field only if the sys_id changes:
function onLoad() {
var lastSysId = '';
setInterval(function() {
var url = decodeURIComponent(top.location.href);
if (url.indexOf('extra-params/') > -1) {
var params = url.split('extra-params/')[1].split('/');
var currentSysId = params[1];
if (currentSysId && currentSysId !== lastSysId) {
lastSysId = currentSysId;
g_form.setValue('manager', currentSysId);
}
}
}, 500);
}
