Create a Link to a File or Directory from a CRM Record

If you are like many of our clients, you still retain a lot of Word and Excel documents about your customers. Wouldn't it be nice to be able to link directly to the appropriate folder from the CRM record for that customer? Here's how to use some OnLoad script to turn a regular text field into a link to a folder.

1) Add a text field attribute called 'folderlink' to your account form. Give it a maximum length of 300 characters to make sure you have enough space for long paths.
2) Paste the following code into the OnLoad event for the Account entity's form:

if (crmForm.all.new_folderlink != null)
crmForm.all.new_folderlink.style.color = '#0000FF';
crmForm.all.new_folderlink.style.textDecorationUnderline = true;
crmForm.all.new_folderlink.style.fontWeight = 'bold';
var folderunc = crmForm.all.new_folderlink.DataValue;
crmForm.all.new_folderlink.ondblclick = function()

3) That's it. Now save and publish your form and paste a path to a folder into that field and try it out. You'll notice that the script above also formats the text in the field to be blue, bold, and underlined so it looks like a standard link, helping your users intuitively understand that they can click on it to open the folder.


Nick said...

Thanks, this is great and it works for network drives as well as sharepoint file stores.

Do you know of a way open an explorer view and save the path back to this field without having to cut & paste? I have been trying and not having much luck.


Oliver Voit said...


I tried to use it in our system. But unfortunately I can´t open any folder. What is the correct syntax to a file path?

Kind regards,


Matt Wittemann said...

It should look something like this:

ICU MSCRM © 2004-2009