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

Open URL in New Tab from Form Button Next to Field (via UI Macro)

Chris Armstron2
Giga Expert

Hi,

I am trying to create a button to the right side of a field, within the incident form, that will redirect to https://google.com, in a new tab, when clicked.

Here is the button:

find_real_file.png

Here is the UI Macro code:

find_real_file.png

Everything I have tried thus far renders the same result, which is a blank page within the current servicenow tab.

Note:  Trying to open google.com for testing purposes only.  Once I am able to perform that step, I will proceed to leveraging the above 'FS Incident ID', in order for our support engineers to navigate to our Monitoring console.

I was able to get a UI Action form button to work just fine, but I would like to be able to provide an additional option to our support staff.

Thanks,

Chris A.

1 ACCEPTED SOLUTION

Chris Armstron2
Giga Expert

With the help of barshaNow, we were able to figure out that the following code works for a UI Macro:

find_real_file.png

View solution in original post

5 REPLIES 5

barshaNow
Mega Expert

Can you just do below in line 12 and try

 

window.open(url);

 

and remove line 13 return false.

Thanks for the suggestion.  Here is what I tried:

find_real_file.png

And it too returns a blank page within the same window.

 

 

 

Chris Armstron2
Giga Expert

Figured it out...

Apparently the name of 'open' that I was using to test with, it conflicting with something.

I changed it to openfs, so that its not too generic, and wha-la, it worked.

I changed it back to 'open', and sure enough, it doesn't work again. 

Chris Armstron2
Giga Expert

With the help of barshaNow, we were able to figure out that the following code works for a UI Macro:

find_real_file.png