Provide clickable link in an email

Vlad_Rozic
Kilo Contributor

hey guys,

 

I am trying to setup an email notification to send out to users after the submit a ticket to request for an item in our Service Catalog.

 

I have it working within the workflow so that the user goes to the Catalog, finds the item, clicks submit, and then the workflow automatically completes the request (as it does not require approval) and sends the user an email notification which I would like to include a hyperlink to the file I wish for them to access.

 

Where I am getting stuck is the email. It sends out to the user fine, but the network share that I would like for them to be able to simply click on doesn't actually link.

 

Is there some scripting that I can implement to achieve this? The file I wish for them to access is a self-installer that will be located on a local server (think \\servername\folder\file.exe\

 

The other alternative would be to attach the file in question, but I can't seem to figure out how to do this.

 

Are either of these options possible?

 

Thanks!

1 ACCEPTED SOLUTION

Ok, this may or may not work:



<mail_script>


      template.print('<a href="http://instancename.service-now.com/scs/airparrot%20install_aus.exe" download>Download Link</a>');


</mail_script>



This is using an HTML5 "download" attribute which essentially forces the client to perform a save as on the link.   It is supported in Firefox, Chrome, and Opera but not Safari and IE.   I don't know how email clients will handle it.   The problem is if the client doesn't support the download attribute, you will get a 404 page or some other Resource Unavailable message.



If you run into this, the only solution is to upload the file in a different way.   You can upload it to ServiceNow as a Knowledge Attachment or attachment to any other record.   But this is the only way to get it stored on the sys_attachment table.   Then you could use the following script in the notification:



<mail_script>


        var sysIdOfAttachment = 'sys_id of the sys_attachment record you uploaded here';


        var userFriendlyName = 'This is what the user will see/click in the email';


        template.print('Attachment: <a href="http://instancename.service-now.com/sys_attachment.do?sys_id=' + sysIdOfAttachment + '">' + userFriendlyName + '</a>\n');


</mail_script>



Edit:   Sorry for the edits, Community was not letting me post because of a gs.getProperty("instance_name") line.


View solution in original post

11 REPLIES 11

ok, I have success now



So I changed a single thing.. I entered in the link in its entirety, so the script looks like this:



<mail_script>  


        var userFriendlyName = 'Air Parrot Install Link';  


        template.print('Attachment: <a href="https://instancename.service-now.com/sys_attachment.do?sys_id=af9f317f0864a100756c6180e21f414a">' + userFriendlyName + '</a>\n');  


</mail_script>



and this works. It acts like any other file you download.



I would prefer to have it so that it autoinstalls without the need to download it first, but honestly this should be good enough.



Can't thank you enough for your help as this is a time sensitive addition to our system!


Snehal2
Kilo Guru

You can use insert/edit link option which is present in notification as shown below.

find_real_file.png

Edit it as:

find_real_file.png

This will be view as below:

 

find_real_file.png