Workspace UI Action always reopens same Record Producer — how to force new form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I’m working in Dispatcher Workspace and I have a UI Action on the sys_user table that should open a Record Producer (Catalog Item) to create an Event.
Here’s the problem I’m facing:
When I click the UI Action from a user record for the first time, it works fine and opens the Record Producer form.
But when I later go to a different user record and click the same UI Action, it reopens the previous Record Producer session (with the old data) instead of loading a fresh form for the new user.
Even after submitting the producer form, the Workspace redirects me to the view details page of the old submission. If I click the UI Action again from a different user, I still end up in that same old form instead of a new one.
Here’s the UI Action code I’m currently using:
function onClick(g_form) {
var recordProducerID = g_scratchpad.PRODUCER_ID_CREATE_EVENT;
var params = {};
params.sysparm_parent_table = g_form.getTableName();
params.sysparm_parent_sys_id = g_form.getUniqueValue();
localStorage.setItem('TEST_user', g_form.getUniqueValue());
g_service_catalog.openCatalogItem('sc_cat_item', recordProducerID, '-1', params); // I also tried g_aw.OpenRecord(); same issue }
I also tried other approaches such as using g_navigation.open() or window.open(), but in Workspace they don’t seem to work.
My Question:
How can I ensure that every time a user clicks this UI Action, it opens a new Record Producer form instance in Workspace (instead of reusing the old one)?
Has anyone else run into this issue in Workspace with Record Producers? Is there a recommended way to force a fresh form each time?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
can you explain below code:
localStorage.setItem('TEST_user', g_form.getUniqueValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have a User variable on the Record Producer, and the value needs to be set based on the record where the UI Action is clicked. To achieve this, I store the current record’s sys_id in localStorage using the key TEST_user.
On the Record Producer’s onLoad client script, I retrieve this stored value, set it to the User variable, and then remove the item from localStorage to avoid conflicts on future submissions. This way, the correct User is always prepopulated when the Record Producer opens from the UI Action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I was able to replicate this issue.
Seems like a platform bug.
Please raise a case with ServiceNow.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader