Possibility to save and close the tab on new records

User492770
Tera Contributor

Hello,

 

we have a custom workspace, where we are creating a record on a separate tab. We don't want users to save it several times, therefore we would like to close it as soon as its saved.

 

It seems that this script works only on saved records, but not new ones.

function onClick(g_form) {

  g_form.save().then(function() {

    g_aw.closeRecord();

     }

}

 

Is it possible to use action handlers in UI actions' scripts?

I came across these Actions:

NAVIGATION_CLOSED

Or could we utilize in UI action somehow this idea: see comment about SCREEN_STATUS_CHANGED status closed. https://www.servicenow.com/community/next-experience-forum/ui-builder-close-tab-and-redirect-back-to...

 

3 REPLIES 3

Dibyaratnam
Tera Sage

I am assuming it's a configurable workspace. How are you saving the record on worspace. Is it using any UI Action or on a button you are triggering any event using client script.

Hello! Yes, this involves a custom workspace created with App Engine and a traditional UI action that incorporates GlideAjax in the Workspace Client script. I'm curious about how to close a new, unsaved record if g_aw.closeRecord isn't functioning as expected. Additionally, for educational purposes, I'm interested in whether it's possible to use action handlers, which are typically employed in UIB, within the Workspace Client script of a UI action.

tpeleg
Tera Expert

Hi @User492770 , did you find a solution for it? I have the same issue 🙂

Thanks!