Monday 10 February 2014

How to form dynamic hyperlink URL for email Template in CRM 2011

Problem:  How to form dynamic URL in email Template.

Solution:

I had a situation in which my workflow had to kick off emails to the sales Rep and those email contain the URL to the record. Now I had to form that URL at run-time grabbing the Guid of the record.

You can achieve this by two way either you can use the "Insert hyperlink" option available in design template as shown below or form URL on your own discuss later in this article:





Once the hyperlink window is opened you can fill the name you want to show and select the “Record URL(Dynamic)” as value and hit ok.






So now when the email is generated you get the link to opportunity record.

But if you want to form the URL dynamically say to open other record or open outlook or link to some another page etc. then you need to form hyperlink on your own.

For example I want to set URL for another record not opportunity from this email template. To achieve this task we will grab the tags that are generated by "Insert hyperlink" option and then edit the values inside it according to our requirements.

<hyperlink>
    <name>
    </name>
    <value>
    </value>
</hyperlink>

This is the basic tags now we will fill the data inside this tag as per our requirements.
<hyperlink>
    <name> URL to Another entity</name>
    <value>https://servername/OrganizationName/userdefined/edit.aspx?etc=10033&id={Guid Of Parent Entity(GetGuidOfParentEntity)}</value>
</hyperlink>

Here I am grabbing the guid of Parent entity by custom workflow utility. 10033 is the entity code for the entity whose record I want to pull out. You can replace servername and organizationName according to your structure.

Thanks,

2 comments:

  1. how can we show this particular url in alert box

    ReplyDelete
  2. So it is interesting and very good written and see what they think about other people. database management

    ReplyDelete