+ Start a Discussion
Allan Lorentzen 6Allan Lorentzen 6 

Custom links and local files

I’ve a requirement from the users to create custom link on account object. (Simple Task).
 
The hard part is not a link to web page, but it is a link to a file. I know have to use a JavaScript execute this link. I have tried some like this, but it does not work.   
 
<script>
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "\\dhsrv01\Accounthierarki\DesignReport.csv";
oShell.ShellExecute(commandtoRun,"","","open","1");
</script>  

Do any one know the answer?
 
Daniel BallingerDaniel Ballinger
Historically there was Knowledge Article Number: 838295 Steps to create a formula field which contains an hyperlink to a local file. However, I can only find references to it in other success community posts. E.g. is there any way to allow local file paths with spaces in a text field? (https://success.salesforce.com/answers?id=90630000000gmXLAAY)

There general idea is:
 
For creating a link to a network/local file, you may need a custom text file (to introduce the path) and a formula field. A URL field will always add "http://" prefix.  Please follow the steps below:

1. Create a text field (for example, with the following name: "Path")
(Setup | Customize | {Object} |Fields and click New in the Custom Fields & Relationships section of the page)
2. Create formula field with data type: Text (for example, with the following name: "File")  to link to that file:

HYPERLINK("file://"&{!Path__c},"View")

You now have a link, called "View," for example, with which the file can be accessed directly from the object by right clicking and selecting "Save Target As."

You can also use this concept to point to network folders - create a formula field on the Account record which links to the network folder for that client, etc.

NOTE: For security purposes, Mozilla applications block links to local files (and directories) from remote files. This includes linking to files on your hard drive, on mapped network drives, and accessible via (UNC) paths. To have access to those files you need to install "Local Link" add-on in your Firefox: http://kb.mozillazine.org/Links_to_local_pages_don%27t_work

Your results may vary depending on the browsers security model.