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

HI Tim,



Thanks for your reply.



So I tried using the File:// designation but it didn't seem to work for me.



When I look in my gmail at the email that is sent to me from the system, it shows the words that should be clickable, but they are not.
They are just regular black font and you can't click on it.



Not sure what the problem could be..


Have you tried linking to the folder, rather than the file? In most cases I would think an executable would be blocked for security reasons.


Unfortunately that isn't really an option.. the purpose of the email is to provide a clickable link that the user can click on and it will initiate a quiet install of an application. That part is all ready to go, I just need the link to be able to provide access.



If this is a no go, how difficult would it be to attach the installer to the email? This could also work, but seems like from what I've read its tricky to setup.