"g_aw" does it work in catalog client script?

Prem13
Tera Contributor

Hi All,

 

Currently i have a ui action in workspace called "Open record producer". Once i click on it, it opens the record producer in a new tab.

 

Now i need to close the tab once the record producer is submitted.

 

I tried with onsubmit catalog client script by adding g_aw.closeRecord();

Prem13_0-1690952363843.png

 

Still that is not working.

 

Is there a way i can close the tab in a workspace?

 

10 REPLIES 10

Nayan  Dhamane
Kilo Sage
Kilo Sage

Hello @Prem13 ,

 

To Close the Window

Write a on submit script which actually run window.top.close(); and close the window after submitting. We need to make sure that this on submit should be the last running onSubmit script

 

To redirect

Use action.setRedirectURL("URL")   in Record producer to send the use to sign out page.

Hope this helps..

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

Hi Nayan,

 

I already tried both window.top.close() on onsubmit catalog client script gives me javascript error though the isolate script is false.

 

And action.setRedirectURL("URL")  is not working in workspace. I tried with producer.portal_redirect that worked but its opening a window within a tab

Prem13_1-1690953709628.png

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Prem13 

you are writing catalog client script which is running on catalog item view?

But as per your question the UI action is in normal form

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

Thanks for replying..

Yes Ankur. The Ui action is on a specific table which will opens the record producer from the workspace.

So I'm trying to create an incident for a specific HR case in workspace

Prem13_0-1690953261654.png

 

Once the user submits the record producer i need to close the current tab (Record producer tab)