Pages

Wednesday, July 27, 2011

CRM 2011 Mashups

Earlier I provided an introduction to mashups in CRM 4.0 including downloads and instructions on how to configure this in your CRM 4.0 environment. This topic then segwayed into a discussion about integration approaches one of them of course being the mashup/virtual integration approach.

It's time now to come full circle and discuss how the mashup/virtual integration can be configured in a CRM 2011 environment. With the new configuration options provided by CRM 2011 it is no longer necessary to refer to an external redirection web page in order to accomplish the objective (using the Navigation Pane). We will step through this example by creating a mashup between a CRM account and a bing map (arguably the most "classic" of mashups).


  • Navigate to Settings | Customizations | Custome the System | Entities | Account | Forms and open up the Main form
  • Click on the Navigation icon. After clicking this the left navigation panel is enabled. 

  • Navigate to Insert | Navigation Link and in the resulting dialog provide a Name and an Icon (none of the other fields need to be filled in - they will be provided at run time using jscript manipulation)


  • Save and Publish the form
  • Open an existing account, hit Ctrl+N to open it so it does not appear in application mode and launch the IE Developer Tools
  • Search for the "Map" navigational item and when you locate it, copy the "navLink" item from the "id" attribute

  • Copy the script below and replace the navlink id with what you copied in the above step

function Map() {


var addresr1        =Xrm.Page.data.entity.attributes.get("address1_line1").getValue();
var addresr2        =Xrm.Page.data.entity.attributes.get("address1_line2").getValue();
var city            =Xrm.Page.data.entity.attributes.get("address1_city").getValue();
var state           =Xrm.Page.data.entity.attributes.get("address1_stateorprovince").getValue();
var postalcode      =Xrm.Page.data.entity.attributes.get("address1_postalcode").getValue();


if(addresr1==null)
{
addresr1="";
}
if(addresr2==null)
{
addresr2="";
}
if(city==null)
{
city="";
}
if(state==null)
{
state="";
}
if(postalcode==null)
{
postalcode="";
}
var parmval=addresr1+" "+addresr2+" "+city+" "+state+" "+postalcode;


var navAcctVal = document.getElementById("navLink{4527a3a5-4173-43b8-3a08-da7da29a1ac2}"); 
if (navAcctVal != null && navAcctVal != undefined) 

var u1 = encodeURI("http://www.bing.com/maps/?v=2&where1="+parmval); 
navAcctVal.onclick =function () { loadIsvArea(Mscrm.CrmUri.create(u1), true); }; 
}


}




  • Link the "Map" javascript function to the main form load event and publish
  • The next time you load an account and click on the Map link, you should be able to see a context sensitive bing map linked to the account you are reviewing


No comments:

Post a Comment