linkedin to dynamics crm integration

1,260

Well looking at this, there are several things...

First, the LinkedIn URL you are dynamically injecting is HTTP and not HTTPS. It also looks like the URL generates a Syntax error when switching it to HTTPS.

Your best bet is to use the API provided from LinkedIn: https://developer.linkedin.com/documents/getting-started-javascript-api

Lastly, the Company Profile you're referencing has been deprecated. Here's the most recent version of what you're trying to do: http://developer.linkedinlabs.com/jsapi-console/#examples/company_profile/hover.html&{"framework":"platform.linkedin.com/in.js","frameworkurl":"","apikey":"","apioptions":"","sessionbuttons":true,"async":false}

Share:
1,260

Related videos on Youtube

Chris Crawshaw
Author by

Chris Crawshaw

Updated on November 21, 2022

Comments

  • Chris Crawshaw
    Chris Crawshaw over 1 year

    I'm trying to get a popup in Dynamics CRM (2011) with information about the account from LinkedIn, as seen here http://www.alticoadvisors.com/Portals/0/Adding%20LinkedIn%20to%20Dynamics%20CRM%20-%20Aug2010%20CRM%20Tip.pdf

    I have attached a field to the form which should change to a button with the form's onLoad function. This worked with a simple piece of javascript in the FunctionName e.g. an alert, however when I tried to add the more complicated script with the Linked In integration, I get a blank window open in Internet Explorer and the button doesn't change.

    I'm afraid I'm quite new the javacript and I can't see where the mistake is. My other fear is that the Linked In part was written for CRM 4.0 and I'm using 2011, but I don't know the differences in the entities to spot and correct any mistake.

    Below is my javascript in the web resource. Any thoughts or pointers would be greatly appreciated.

    Chris

    function open()
    {
    ConvertToButton('new_buttonfield', 'LinkedIn','100px',FunctionName,'Button Label'); 
    }
    
    function ConvertToButton(fieldname, buttontext, buttonwidth,clickevent, title)
    {
    
     //check if object exists; else return
     if (document.getElementById(fieldname) == null)
    {
        alert("no field by that name");
        return;
     }
    
    
     functiontocall=clickevent;
     crmForm.all[fieldname].DataValue = buttontext;
     crmForm.all[fieldname].readOnly = true;
     crmForm.all[fieldname].style.borderRight="#3366cc 1px solid";
     crmForm.all[fieldname].style.paddingRight="5px";
     crmForm.all[fieldname].style.borderTop="#3366cc 1px solid";
     crmForm.all[fieldname].style.paddingLeft="5px";
     crmForm.all[fieldname].style.fontSize="11px";
     crmForm.all[fieldname].style.backgroundImage="url(/_imgs/btn_rest.gif)";
     crmForm.all[fieldname].style.borderLeft="#3366cc 1px solid";
     crmForm.all[fieldname].style.width=buttonwidth;
     crmForm.all[fieldname].style.cursor="hand";
     crmForm.all[fieldname].style.lineHeight="18px";
     crmForm.all[fieldname].style.borderBottom="#3366cc 1px solid";
     crmForm.all[fieldname].style.backgroundRepeat="repeat-x";
     crmForm.all[fieldname].style.fontFamily="Tahoma";
     crmForm.all[fieldname].style.height="20px";
     crmForm.all[fieldname].style.backgroundColor="#cee7ff";
     crmForm.all[fieldname].style.textAlign="center";
     crmForm.all[fieldname].style.overflow="hidden";
     crmForm.all[fieldname].attachEvent("onmousedown",push_button);
     crmForm.all[fieldname].attachEvent("onmouseup",release_button);
     crmForm.all[fieldname].attachEvent("onclick",functiontocall);
     crmForm.all[fieldname].style.lineHeight="14px";
     crmForm.all[fieldname+'_c'].style.visibility = 'hidden';
     crmForm.all[fieldname].title=title;
     window.focus();
    
    }
    
     function push_button(){
     window.event.srcElement.style.borderWidth="2px";
     window.event.srcElement.style.borderStyle="groove ridge ridge groove";
         window.event.srcElement.style.borderColor="#3366cc #4080f0 #4080f0 #3366cc";
     }
    
     function release_button(){
     window.event.srcElement.style.border="1px solid #3366cc";
     }
    
    
     function LinkedInLoader(crmFormField) {
    
         var ll = this;
         ll.scriptSource = 'http://www.linkedin.com/companyInsider?script&useBorder=yes'
         ll.field = crmFormField;
         ll.container = crmFormField.parentNode;
         ll.nameToSearch = crmFormField.DataValue;
         ll.spanId = ll.field.id + '_linkedin';
         if (ll.container != null) {
             var span = document.createElement('span');
             span.id = ll.field.id + '_linkedin';
             var td1 = document.createElement('td');
             td1.innerHTML = ll.container.innerHTML;
             var td2 = document.createElement('td');
             td2.appendChild(span);
             td2.style.width = '15px';
             var tr = document.createElement('tr');
                 tr.appendChild(td1);
             tr.appendChild(td2);
             var table = document.createElement('table');
             table.width = '100%';
             table.style.tableLayout = 'fixed';
             table.cellSpacing = 0;
                 table.cellPading = 0;
             table.appendChild(tr);
             ll.container.innerHTML = table.outerHTML;
         }
    
         ll.ApplyCorrections = function () {
             var div = document.getElementById('company-insider-info-window');
             if (div != null) div.style.height = '275px';
             else window.setTimeout(ll.ApplyCorrections, 500);
         }
    
         ll.Enable = function () {
             new LinkedIn.CompanyInsiderPopup(ll.spanId, ll.nameToSearch);
             new LinkedIn.CompanyInsiderStylesheet();
             var span = document.getElementById(ll.spanId);
             if (span != null) span.attachEvent('onclick', ll.ApplyCorrections);
         }
    
         ll.OnScriptReadyState = function () {
             if ((event.srcElement.readyState == 'complete') ||
        (event.srcElement.readyState == 'loaded')) {
                 ll.Enable();
             }
         }
    
         ll.Load = function () {
             var script = document.createElement('script');
             script.type = 'text/javascript';
                 script.src = ll.scriptSource;
             script.onreadystatechange = ll.OnScriptReadyState;
             document.getElementsByTagName('head')[0].appendChild(script);
             }
     }
    
    // now the definition of the function to call on button click
    function FunctionName()
    {
    //if (account.FormType != 1) {
        // Set the field that contains the company name
        var linkedInLoader = new LinkedInLoader(crmForm.all.name);
        linkedInLoader.Load();
        //}
     }