Simplify sharing of opportunities (Or any entities) with direct e-mailing links


One thing I found useful when working with MSCRM is the possibility to directly access
records by hitting its direct URL. Out-of-the-box this can be manually done by
opening a record and hit CTRL-N or CTRL –D. Later copy the URL and past it to
your e-mail. Whoa I love CTRL-C. Well by adding below script to your onload you
will have a new ready to email link in your right corner of the record.


  • Fast access to direct record, sharing, etc
  • Useful for testing
  • Could be extended with url copied to clipboard

    Feel free to rewrite script in an iframe for support. See this script as an idea.

    NOTE! Customizations directly to the DOM are not supported by the product group.




    Notice new link in right corner of entity! Click the E-mail opportunity link to
    open outlook with direct URL pasted to e-mail




    function createSendLink()

    {

    var strUrl = “”;

     

    if (IsOnline())

    {

    var title = “Please followup on Opportunity [”
    + crmForm.name.DataValue + “]”;

    var id = crmForm.ObjectId;

    id = id.replace(“{“,””); id =

    id.replace(“}”,””);               

    query
    = ” + this.location;

    query
    = query.substring(0, query.indexOf(‘?’));

    strUrl
    = query + “/sfa/opps/edit.aspx?id=”;                     

    }

     

    if (IsOutlookLaptopClient())

    strUrl
    = crmRcUtil.ServerUrl.replace(“MSCRMServices”, “”) +
    “sfa/opps/edit.aspx?id=”;

     

    strUrl
    = escape(strUrl);        

    var a = document.createElement(“a”)

    var aText = document.createTextNode(“E-mail
    opportunity link…”)

    a.href
    = “mailto:&subject=”+title+”&body=” + strUrl + id;       

    a.name
    = “EmailLink”;

    a.appendChild(aText)

     

    if
    (document.getElementById(‘_MBcrmFormSubmitCrmForm1truetruefalse’)!= null)

    {

    var cur =
    document.getElementById(‘_MBcrmFormSubmitCrmForm1truetruefalse’)            

    document.getElementById(‘mnuTitle’).insertBefore(a,
    cur.nextSibling);

    }                    

    }

     

     

  • Comments (5)

    1. Chris Brown says:

      I have copied you code and pasted it directly into on Onload event, but it is not doing anything.  Not even an error when the form loads.  I have published it and it is also enabled.  Do you have any ideas?

      Thanks,

      Chris

    2. Please call the function createSendLink() somewhere in onload and it will work

      … copy and past code above …

      and add this line

      createSendLink();

    3. crul says:

      I have copied you code and pasted it directly into on Onload event, but it is not doing anything.  Not even an error when the form loads.  I have published it and it is also enabled.  Do you have any ideas?

    4. Have you tried it on the opportunity entity? I just verified and it works fine on my CRM 3.0 system.

    5. meadx says:

      Hi there,

      Do you have a solution like this that works for CRM 4.0? I cannot get this version to run.

      I suspect the Elements have changed name in the new release.

      eg “_MBcrmFormSubmitCrmForm1truetruefalse”

      Any ideas? I would love to get this working on CRM 4.0

      Cheers

       

      Email direct links are on form in CRM 4.0 so there is no need for this CRM 3.0 functionality