Integrating accounts with LinkedIn

Pulling a company profile from the data they maintain is always a better idea than having to maintain that information yourself. While we won't be able to have all customers update all the profile information we need to track, bringing in some information from their public profiles will always make things easier on our team.

In this recipe we will look at a simple way of bringing a customer's LinkedIn card information on their profile page. In addition, this pull of data happens exclusively on the client side.

Note

Always check with the data provider to determine if the terms of use allow you to implement this kind of customization in your specific scenario.

Getting ready

In order to test this solution, you will need access to a Dynamics CRM instance and be a part of system customizer or system administrator permission.

You can create a new solution package or reuse an existing one.

How to do it...

Perform the following steps to add the LinkedIn company card to your CRM Account form:

  1. Create a new solution package if one is not already available.
  2. Add the Account entity to your solution.
  3. Open the Account main form to edit.
  4. Make the Account Name field span two columns. This way the full card width can be displayed right underneath the account name.
  5. Save and Close the form.
  6. Add a new web resource of type JScript. Name it LinkedIn Company Profile (new_LinkedInCompanyProfile).
  7. Add the following function to your web resource:
    function LinkedInCompanyProfile()
    {
      var _companyName = Xrm.Page.getAttribute("name").getValue();
      
      if(_companyName != null && _companyName != "")
      {
        while(_companyName.indexOf(" ") != -1)
        {
          _companyName = _companyName.replace(" ", "-");
        }
        _companyName = _companyName.toLowerCase();
        $("#name").after(function(){
          var script = '<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>' +
          '<script type="IN/CompanyProfile" data-id="' + _companyName + 
          '" data-format="inline" data-related="false"></script>';
          return script;
        });
      }
    }
  8. Save and Close your web resource.
  9. Add a new web resource of type JScript. Name it jQuery (new_jquery).
  10. Load the jQuery library in this web resource.
  11. Save and Close the web resource.
  12. Return to the Account main form.
  13. Add to the Form Properties a reference to the jQuery resource.
  14. Also add a reference to the LinkedIn Company Profile web resource.
  15. In the form's OnLoad event handler, add a reference to your LinkedInCompanyProfile() function.
  16. Click on OK to close the Form Properties.
  17. On the account name's Field Properties, add a new event handler for the OnChange event, and reference your LinkedInCompanyProfile() function.
  18. Click on OK to close the Field Properties window.
  19. Save and Close the Account form.
  20. Save and Publish your solution.
  21. Open an account record. If no account record is in there in the system, create a new one.
  22. Once a record is retrieved, the company LinkedIn profile card is displayed if the company profile is found on LinkedIn.
    How to do it...

How it works...

Using the value of Account Name defined as the name of the company, this script retrieves the company card from LinkedIn and displays it on the form, right under the Account Name field. With it, you get a link back to the company profile in LinkedIn, along with the company name, the logo, and a short description.

Note

Please be aware that this functionality does not perform a search of companies on LinkedIn, but rather it looks-up a company by its exact name defined in the Account Name field. For situations where the stored account name is different than the company name defined in the LinkedIn profile, a new custom field can be created to capture the publicly available company name.

There's more...

This example uses jQuery only for page location and to insert the actual card after the account name. You could easily change the location of the company card by selecting any other tag on the page.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.18.65