Wednesday, February 08, 2012

CRM 2011: Creating a Network Path Text Control for Microsoft Dynamics CRM 2011

Following approach is a little bit unsupported so be careful using it.

Create JavaScript webresource, put in it following code, call OnLoad method during loading of form of your entity:

function OnLoad()
{
Transform("new_name");
}

function Transform(fieldid)
{
var c = document.getElementById(fieldid);
if (c == null)
return;

c.style.textDecoration = "underline";
c.style.color = "blue";
c.style.cursor = "hand";
c.ondblclick = function()
{
window.open(Xrm.Page.getAttribute(fieldid).getValue());
};
}


Field has to be simple text type. Replace new_name with field you want to transform. Result for my case:

7 comments:

  1. This script Works very fine...
    Thank you very much Andrii.

    ReplyDelete
  2. You are welcome, Suresh. I am trying to do something that works.

    ReplyDelete
  3. hi'
    i used the same code to open a file from CRM online... could open any website but cant open file from my pc..any pointers?

    br
    irf

    ReplyDelete
    Replies
    1. What did you do to solve the problem? I'm having the same issue. It makes it into a link but won't get to my network drive. All URLs work fine.

      Delete
    2. This doesnt work, does it only work in certain versions of IE?

      Delete
    3. This works for me and for several other users who tried this code so it seems that issues on your side. what environment do you have - CRM Onpremice or online, what is the version of IE?

      Delete