How do I get target destination to open in a new window?

thomaskennedy
Tera Guru

In my list I'm opening a destination page and passing the table and sys_id. But how do I get the destination to open in a new window?

4 REPLIES 4

sonali panda1
Kilo Sage

If you have the url then you can do this using an achor tag by adding target="_blank" like so

<a href="www.example.com /example.html" target="_blank">link text</a>

 

 

Else you can have an onclick function that takes you to the client script in which you would format the url and use this window.open("https://www.w3schools.com");

Kirankumar Amba
ServiceNow Employee
ServiceNow Employee

If you are planning to open in new Workspace Tab, you can emit an event from Client script: 

    api.emit("NAV_ITEM_SELECTED", {

          "redirect": true,

          "route": "<path>",
          "fields": {
          },
          "params": {
                "query": `<urlParams_query>`,
                "listTitle": "<Tab_title>",
                "listView": "<view>"
           }
    });

Hope this helps!

Kirankumar, I don't think I understand how, in this example, you're directing the output to a new browser window. As I understand it the route attribute tells what Page (in my case) I want to send the user to. Good so far. But that will open in the current window unless... what?

Perhaps you mean there is a url param that will cause the browser open the page in a new window. I know of no such parameter.

If I use link to destination and use this object it opens in a new window. Oddly, setting the title doesn't do anything.

function evaluateEvent({api, event}) {
    return {
        route: null,
        fields: null,
        params: null,
        redirect: null,
        passiveNavigation: null,
        title: "anything",
        multiInstField: null,
        targetRoute: null,
        external: {
            url:"/x/acso/rf/device/table_name/" + event.payload.sys_id
        }
    };
}