zaterdag 20 april 2013

Extending the Microsoft Outlook Client for Microsoft Dynamics CRM 2011 (part 2)

The Microsoft Dynamics CRM Outlook client
By default the Microsoft Dynamics CRM outlook client provides users the ability to track e-mails by using the "Track" button. All users are familiar with this functionality and use this whenever an e-mail is required to be tracked by your organization.

What actually is missing here is a basic feature to register more information related to this e-mail and customer. For example, a user tracks an e-mail message and wants to fill in related information and create a follow-up task as well. It can be done when a user clicks the "View in CRM" button but it may take many clicks and open windows to actually take care of this e-mail.

Extending the client
There are many ways to extend the Outlook client but for this example I will allow the user to simply click on a follow-up button that triggers a dialog process from within a managed html webresource

Creating a dialog
Because this blog is not about creating dialog processes I will ask you to go to the following video and make sure you create a dialog process based upon the e-mail entity and you know the corresponding guid. You can get the guid by running the dialog from within Microsoft CRM and press ctrl+n. You will probably see a long url in Internet Explorer. The id is marked in bold.{ECDB724E-EDA9-E211-B63A-D4856451BCD1}

Creating a html webresource
As for the html webresource you can use the following code. Make sure you enter the dialog guid correctly and notice this webresouce requires a parameter "emailid" in order to run.
Before actually start embedding this webresource in Outlook, make sure it will run in your browser. Let's name this webresource dh_Outlookemail.html and test this webresource by replacing the bold guid by a correct e-mail guid and entering the following url:


<html><head><meta charset="utf-8">
<script language="javascript"> 

var emailId = null;
var dialogId = 'E49AC7F1-BFF5-44DF-BE2C-2E05A7946B92';

getParams = functionundefined){
   var href = decodeURIComponentundefined location.href );
    var vars = [], hash;
    var hashes = href.sliceundefinedhref.indexOfundefined'?') + 1).splitundefined'&');
    for undefinedvar i = 0; i < hashes.length; i++) {
        hash = hashes[i].splitundefined'=');
        vars[hash[0]] = hash[1];
    return vars;

ShowRelatedData = functionundefined) {
  var parameters = getParamsundefined);
  ifundefined parameters['emailid'] != null ) 
      document.getElementByIdundefined 'btnStartFollupupDialog').style.display='block';
      emailId = parameters['emailid']; 

showFollowupDialog = functionundefined) {
    var url = location.href.substringundefined0,location.href.length - location.pathname.length) + '/cs/dialog/rundialog.aspx';
    url += "/cs/dialog/rundialog.aspx?DialogId=%7b" + dialogId + "%7d&EntityName=email&ObjectId=" + emailId ;
    window.openundefinedurl, "", "status=no,scrollbars=no,toolbars=no,menubar=no,location=no");

<body bgcolor="#dddddd" onload="ShowRelatedDataundefined);">
  <button id="btnStartFollupupDialog" onclick="showFollowupDialogundefined);">Run follup up dialog</button><br>

What's next?
Part 3 (the actual Microsoft Outlook Client for Dynamics CRM 2011 Extension) and sourcecode will be available soon.


Geen opmerkingen: