Dynamic values in URLs in Email Template RRS feed

  • Question

  • Hello,

    I'm trying to create an Email Template to email customers a link to a survey site. In order to tell who the survey is from, or other context info, we can send in URL parameters.

    For example: www.website.com/?caseID=1234.

    I have tried copying from Word with the link such as <a href="www.website.com/?caseID={!User : First Name;}">website survey</a>, then pasting into an email template, which then shows this a literal string.

    I have tried copying from a simple HTML page (not the source), (same link as above), then pasting into CRM. This actually rendered it as a link, but CRM did not populate the dynamic value.

    I have tried copying and pasting the source from the HTML page, pasting into CRM, but that just shows the HTML as literal strings.

    This leads me to believe that it cannot be done, because CRM only populates dynamic fields if you insert it through CRM, and only renders HTML if you copy and paste it from a rich text editor. So please, if you could help me figure this out, or just flat out tell me it can't be done, that would save me a lot of time messing around with this stuff, and I could just do this from my website instead of CRM.

    Maclain Wiltzer
    Software Developer
    Tuesday, December 14, 2010 12:03 AM


All replies

  • Hi Maclain, I'm not sure if it solves your issue exactly, but the CRM 4.0 Solution Accelerator for Business Productivity Workflow Tools includes a tool for HTML hyperlink creation.


    Might be worth investigating.

    Regards, Neil

    Neil Benson, CRM Addict and MVP at Customery Ltd. You can reach me on LinkedIn or Twitter. Join over 10,000 other CRM professionals on the Microsoft Dynamics CRM group on LinkedIn.

    • Marked as answer by Makolyte Tuesday, December 21, 2010 9:35 PM
    Tuesday, December 14, 2010 6:16 AM
  • Hello,

    I was able to get it working using the link you sent. One thing though, why do the emails sent have a tag: " CT:023000035", and how do i get rid of that?

    Thanks for your help,


    Maclain Wiltzer
    Software Developer
    Tuesday, December 21, 2010 8:45 PM
  • That's the email tracking token. It improves the accuracy of matching incoming replies to the original outbound emails, but isn't required. You can turn it off in System Settings.

    Neil Benson, CRM Addict and MVP at Customery Ltd. You can reach me on LinkedIn or Twitter. Join over 10,000 other CRM professionals on the Microsoft Dynamics CRM group on LinkedIn.

    Tuesday, December 21, 2010 8:47 PM
  • Oh i see. Because someone could change a letter in the subject when they reply and it would screw up the tracking?


    Another question, I'm sending emails to myself and another user. The other user's workflow history says it succeeded but when i drill down to the "Send email" step it says "This message has not yet been submitted for delivery"? (I can start a new thread about this if you want)

    Maclain Wiltzer
    Software Developer
    Tuesday, December 21, 2010 9:52 PM
  • Maclain ,

    I noticed that message as well. Sometimes it takes a bit for the message to actually get sent.  Just Refresh via the double green arrows near the top right of the History display

    Wednesday, May 4, 2011 10:44 PM
  • Hello all,

    I am having this exact issue, but I am using CRM 2011. Are there any new updates or articles that have solutions for CRM 2011? All of the links here seem to only be relevant to CRM 4.0...



    Tuesday, August 30, 2011 5:05 PM
  • Hi everyone,

    I found a work around for this issue that my team decided to implement. Though it may not be the ideal solution, it does accomplish the desired result without extra solutions, plugins, development efforts, or other extensions. Here is what I did:

    I added a custom field to the case (incident) entity called 'Survey Link'. I created a separate workflow to fire on case create which updates that new field on the case record in the form of an href link with dynamic data (about the case, user, contact, or whatever). This custom field then needs to be populated and stored on the case record in the form of a URL like so:

    <a href=www.website.com/?caseID= DYNAMIC FIELD FROM EDITOR >Test Link with Dynamic Field in URL</a>

    Then, on a separate email workflow where the URL is needed, simply add the 'Survey Link' dynamic field in the body of the message, and the unique URL will be formatted as HTML and display as a link in the email message.

    Hopefully this makes sense and can help someone else out.



    Wednesday, September 7, 2011 1:27 PM
  • Hi again,

    So, UPDATE to my above solution: while the two workflow solution does work, I discovered a problem with the case entity. If you save a new case (firing the workflow to populate the link field on create) and immediately resolve the new case, the asynchronous workflows can conflict with each other. I had it happen several times where the case would be resolved before the link field was updated, and this caused an error with updating the link field because the case was then read-only. Thus the downside (in this case) of asynchronous processes not firing linearly.

    The fix we implemented for this issue is to instead of use 2 workflows, create a new web resource with Javascript that fires on the onSave event of the case that dynamically populates the link field on the case (instead of the on Create workflow). This ensures that the field gets populated with the saving of the case because it is not possible to resolve the case from the UI until the page is refreshed and thus the javascript is complete. The javascript function would be registered on the on save event and look similar to the following:

    function SendSurveyFieldUpdate()
     var fieldNeeded = Xrm.Page.data.entity.attributes.get("schemafieldname"); //schema field name (must be on the form)
     var surveyURL = "<a href="http://mysurvey.com/field=" +  fieldNeeded.getValue() + "\">Click Here for Survey!</a>"; //Populate dynamic URL with current record data
     Xrm.Page.getAttribute("new_surveylink").setValue(surveyURL); //set your new field with the dynamic link

    Note: this is only an issue if the entity you're working with can have a regular status change and become read-only, and if the workflow logic is on a status change to close (read-only). Contacts (unlike cases), for example, do not change status often, so you may be able to get away with using the original two workflow solution as described in my previous post, and you can similarly use that solution if the workflow logic is not dependent on status changes (closing a record).

    Thanks again and Regards,


    • Proposed as answer by kspicer Tuesday, September 27, 2011 12:39 PM
    Tuesday, September 13, 2011 2:03 PM
  • can any one tell me how to use it in E-mail templates...

    i want this feature in email templates and in the url i want to pass the contacts' fullname(suppose.





    Wednesday, May 9, 2012 10:41 AM
  • hi Kspicer,

    does it work in MS CRM 4.0?

    i tried it did not work...

    i need it in E-mail template...

    anyone can help me...



    Wednesday, May 9, 2012 10:51 AM