In this recipe, we will be looking at the most simplistic way to bring Facebook information into your CRM. We are doing this exclusively on the client side, thus adding no additional load on server resource. For this reason, the client machine will need to have internet access, and the access to Facebook should not be blocked by the corporate firewall.
We will be taking advantage of the Facebook Badge feature. If you go to http://www.facebook.com/badges/, you will find the available badge options. For this example, I will focus on using the Profile badge. We will capture the contact information as it relates to Facebook from the system user, and we will display a Profile badge on the Contact form.
You will need access to a Dynamics CRM 2011 instance. In addition, you will need the system customizer or system administrator permissions.
If you do not have a solution package already created, you should create one for this chapter.
You can use either a CRM Online instance or an On-Premise deployment for this solution. If you are using On-Premise, make sure that the user machines have direct access to the internet, and that the Facebook site is not being blocked or filtered by the corporate firewall.
Also, if you are accessing the corporate CRM instance through a VPN connection and if the connection drops your internet connection while the VPN is active, then this recipe will not work. Please work with the network infrastructure team supporting your final production deployment to make sure this is a supported scenario.
In order to add a Profile badge on the Contact entity, perform the following steps:
FacebookScript
(new_facebookscript
).function getFacebookBadge() { var _fbURL = Xrm.Page.getAttribute("new_facebookurl").getValue(); if(_fbURL != null && _fbURL != "") { var _fbuser = _fbURL.substring(_fbURL.indexOf("facebook.com/") + 13); $("#new_facebookurl_d").append("<a href='"+_fbURL+"' target='_blank'><img src='http://graph.facebook.com/"+_fbuser+"/picture?type=normal'/></a>"); } }
jQuery
and load the latest jQuery library available at http://jquery.com/.jQuery
resource to the Form Libraries.Facebook Badge
and check the Show the label of this section on the Form and Show a line at top of the section checkboxes.Facebook URL
(new_facebookurl
).OnChange
event of the new_facebookurl field.OnLoad
event.http://www.facebook.com/username
format.This integration method brings over the profile picture of the contact or account, as presented and maintained on Facebook by the owner. While for companies (accounts), it's almost guaranteed to get a logo or a relevant image, when using this approach with contacts be aware that since Facebook is not really a professional network, some images retrieved might not present the person in a professional way.
In addition to retrieving the logo image of a contact or account, using the Graph API you can retrieve additional information. For details on using the Graph API, see the Facebook Developers documentation at http://developers.facebook.com/docs/reference/api/.
18.189.171.52