The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Workspace UI Action always reopens same Record Producer — how to force new form?

Niharika20
Tera Expert

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!

1 REPLY 1

RaghavSh
Kilo Patron

can you explain below code:

   localStorage.setItem('TEST_user', g_form.getUniqueValue());

 


Raghav
MVP 2023