Declarative Action to Open Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello,
I have a scoped app that has a tab where I created a declarative action as a client script. I then added the script below in order to open a form. The issue is that it not only opens the form with a tab next to the case, but I am also opening up a new browser/window tab. I only want the form to open a new tab, not another window. I have tried many variations for opening this where some work and some don't. Can anyone give me some direction please?
Also, this form that is opening will need most of the fields prefilled from the parent table, recommendations on the best way to accomplish this would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
It looks like you are in Workspace so GlideAgentWorkspace should be available in your instance.
Rather than generating the link the way you are you could use g_aw.openRecord('table name', 'record sys_id') to achieve this.
Using this method replace 'table name' with the table and pass the sys_id as -1. This will open the form in only a workspace tab.
I believe you should be able to pass the third parameter "params" to prefill fields on the form.
"params": { "readOnlyForm": Boolean; "defaultTab": "String"; "hideDetails": Boolean }
Documentation on the GlideAgentWorkspace: https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Thank you, sorry I didn't get back to you sooner, the g_aw method above is till opening a new window and not opening the form within the tab. I have tried several methods with no luck so far, Is there another way to achieve opening the form in the form from a button on a specific tab that opens the form on a tab instead of a new window?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
If the glide agent workspace method is opening it in a new browser tab then you may have something outside of ServiceNow doing it. The only other thought is that you may a separate onClick script that is opening the new browser tab. I would make sure you don't have multiple onClick scripts being triggered and if that isn't the case then I don't know what may be the cause.
Would need to evaluate the console and such via dev tools when you click the button to possibly track down the issue.