Integrate CRM Accounts with LinkedIn

Integrating CRM Accounts with LinkedIn is a very easy step. I have found numerous examples on doing this by using a Web Resource, but I don’t like the way it displays in a frame. It looks anything but professional.

So I decided there’s got to be a better way of doing this.

First off, I am using the jQuery library, so you will need to add that to your resources. It will make it so much easier to select elements on the page.

I have added an on load function to the account:

function Account_onLoad()
{
    var nvs_AccountName = Xrm.Page.getAttribute("name").getValue();
   
    $("#name").after(function() {
        var script = ‘<script src="
http://platform.linkedin.com/in.js" type="text/javascript"></script>’ +
        ‘<script type="IN/CompanyProfile" data-id="’ + nvs_AccountName +
        ‘" data-format="inline" data-related="false"></script>’;
        return script;
    });
}

I am looking for the Account name, as populated in the Name field, and retrieving the LinkedIn profile based on that. I have re-arranged the form to provide the space for the section that will be inserted right below the Account Name field:

image

In the Form Properties, add your references as below:

image

once you have all that set up, try opening an account, and you will get the following view:

image

No more iFrames, it just looks like it belongs there.

The beauty of this approach is also the fact that, if an account is not found on LinkedIn, no problem, the screen will look like so:

image

NOTE: Please be aware that you will get the following prompt:

image

Add LinkedIn to your browser’s trusted sites. In the Trusted Sites configuration, click on Custom level.

image

Set Display Mixed Content to Enable.

image

This setting can be pushed through a group policy. For more details see KB2625928.

Enjoy!

4 thoughts on “Integrate CRM Accounts with LinkedIn

Add yours

  1. This solution looks really great. It also seems to work using https: for the linked script (ie they publish the same URL using SSL), which seems to remove the need for allowing “mixed content”.

    Also, the way it is posted has lots of “smart” or “curly” single quote marks, which means I had to go and hand edit lots of these to normal “straight” quotes before it would parse and run properly.

    So now it works great – sometimes

    However, it does seem to have a big flaw. It only works with companies whose name has a single word. Navantis is fine, as is Microsoft, but most of my accounts simply don’t come up, even when they are definitely on LinkedIn. I have created new accounts for a bunch of test records and it seems pretty consistent that single words work, more than one don’t. I have no idea whether this is down to the LinkedIn script or yours, and because I have no experience using the jQuery library I am struggling to interpret your script in it’s current form which is effectively obfuscated from my point of view as I don’t have any grasp of the jQuery syntax or internal functions.

    Any ideas how to get this to work for companies with names containing spaces?

    It would also be great if this could do a try/catch with the whole name, and if nothing is returned, try again with the last “word” removed from the name since many companies may be on LinkedIn as eg Microsoft, but as their incorporated name such as Microsoft Plc in someone’s CRM Account records. Dropping the Plc would fix this situation, although of course not the reverse.

    Like

    1. Hi Adam,

      at first sight, you are correct. If the company name is composed of multiple names, this script does not render. The reason is that the spaces have to be translated. You would expect to replace the spaces with the %20 encoding, but LinkedIn does not use that format. Instead, you have to replace spaces with dashes. For example, if your company name is “Bank of America”, you would have to pass the string as “Bank-of-America”. Use
      string.replace(” “, “-“)
      where string is the string tha contains the company name.

      Like

Leave a comment

Create a website or blog at WordPress.com

Up ↑