Thanks for quick reply,

 

 Still form is redirecting to other page

 

function confirmDownload() {
 
var URL = 'nav_to.do?uri=sys_attachment.do?sys_id=aec12b1b970321100408bde3f153affb';
    var down = confirm('Do you want to download the file?');
     alert(down);
    if (down) {
g_navigation.openPopup(URL);
action.setRedirectURL(url);
  action.setReturnURL(current);
    }
 
}
 
g_navigation.openPopup(URL); - seems this line is causing issue - but if remove this line file is not downloading

Nag9
Tera Expert

@Ankur Bawiskar  Could you please help me on this

 

Ankur Bawiskar
Tera Patron

@Nag9 

your UI action should be client side and update script as this

No need to use action object

function confirmDownload() {
	var URL = '/sys_attachment.do?sys_id=aec12b1b970321100408bde3f153affb';
	var down = confirm("Do you want to download the file?");
	if (down == true) 
		g_navigation.open(URL, '_blank');
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Awesome Ankur, its working.

without action object - if I click the link file is not downloading.

With action object - it is working perfectly.

Here is the code:

function confirmDownload() {
var URL = '/sys_attachment.do?sys_id=e33c48b32f4321108bc8ad6df699b631';
var down = confirm("Do you want to download the file?");
if (down == true)
g_navigation.open(URL, '_blank');
}

 

Nag9_1-1685704103080.png

 

Is this List v2 Compatible that should be enabled in the form? 

 

Nag9_2-1685704279966.png

 

 

 

 

 

@Nag9 

you are doing this in native view right?

it should work fine.

Can you share your latest script and UI action configuration screenshot along with the form where you are testing this?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader