Stop redirect from UI Macro when Document download link is clicked

chadp
Mega Contributor

Hi Community!

Have an issue with a UI macro for downloading a SOP document from a knowledge base article.  

When I preview the record producer myself the download works correctly but the record producer preview window redirects to the homepage url.

When I impersonate a Customer user who would be accessing this SOP document , the below screenshots show, the redirect happens again but completely freezes the instance. and also it does not download.

Can anyone advise on the redirect issue and the download not working for the Customer user?

Screenshot 1: User clicks the SOP document link

find_real_file.png

Screenshot 2:   UI Macro does not Download document and redirects to frozen duplicate homepage screens

find_real_file.png

1 ACCEPTED SOLUTION

Gurpreet07
Mega Sage

It seems like again you are using a deep link and its   opening frame inside a frame. There shouldn't be 'nav_to.do?uri=' in the link. Remove bold part from below link.


"https://test.service-now.com/nav_to.do?uri=sys_attachment.do?sys_id=5ae18a3c37abb200a1e9466754990e00"


If the attachment is on same instance then you could also use a relative link


"/sys_attachment.do?sys_id=5ae18a3c37abb200a1e9466754990e00"


After all the user should have access over attachment.


View solution in original post

8 REPLIES 8

Gurpreet07
Mega Sage

Hi Chad,



Where are you redirecting the user.. Please paste the link in here. try to include   target="_blank" in the   <a> tag. Also do not use deep link (don't use nav_to.do?uri=..) in link.


chadp
Mega Contributor

Apologies, completely forgot to put the UI Macro xml



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <a href="https://test.service-now.com/nav_to.do?uri=sys_attachment.do?sys_id=5ae18a3c37abb200a1e9466754990e00">SOP Document</a>


</j:jelly>



We do NOT want the url to redirect at all, but it seems to no matter what


Gurpreet07
Mega Sage

Try below code



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <a href="https://test.service-now.com/sys_attachment.do?sys_id=5ae18a3c37abb200a1e9466754990e00" target="_blank">SOP Document</a>


</j:jelly>


chadp
Mega Contributor

That seemed to work, for me at least, but when I impersonate a customer user who has access to the Knowledge base it just has a blank page pop up in new tab and no download.  




When I click the url macro link the blank page appears and disappear once download occurs which is the expected behavior.



Is there something missing ?