Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, December 18, 2017 
 
Integrating SalesLogix Leads with LinkedIn  
Description:  Social networks have become a big part of today's online landscape. This is true for professionals as well. LinkedIn is a social network that allows professionals to find out more and interact with others whose needs or services align with themselves. This article will show how we can integrate this resource with leads in SalesLogix to show our SalesLogix users as much information about our leads as possible and will provide a complete sample for integrating LinkedIn with SalesLogix leads.

Category:  SalesLogix VBScript Articles
Author:  Ryan Farley
Submitted:  6/19/2007
   
Stats: 
Article has been read 19894 times

Rating: - 5.0 out of 5 by 5 users
 

fiogf49gjkf0d
Integrating SalesLogix Leads with LinkedIn

Social networks have become a big part of today's online landscape. This is true for professionals as well. LinkedIn is a social network that allows professionals to find out more and interact with others whose needs or services align with themselves. This article will show how we can integrate this resource with leads in SalesLogix to show our SalesLogix users as much information about our leads as possible and will provide a complete sample for integrating LinkedIn with SalesLogix leads.


What is LinkedIn?

LinkedIn is a social networking site that, according to it's About LinkedIn page, LinkedIn's mission is to help you be more effective in your daily work and open doors to opportunities using professional relationships. It's basis is to help match you up with others, whose needs align with services you provide, create opportunities with other professionals, and to provide information about others in the LinkedIn community. Whether LinkedIn lives up to this or not, the fact is that there is useful information that can certainly add value to our leads in SalesLogix. Helping us to know more about them and make it easier for our SalesLogix users who work with leads to connect with them. Credit for the idea of integrating leads with LinkedIn goes to Ryan Lowermilk, who posted an article about integrating LinkedIn with SageCRM (a 100% web-based CRM application) on his blog.


Overview of Integrating LinkedIn with Leads

Unfortunately, LinkedIn does not provide an SDK or webservices layer for us to integrate with. The technique we'll use is one known as "screenscraping". What screenscraping means, is that we'll programatically retrieve the HTML for a webpage, in our case the LinkedIn search results page, and then parse it to see what the results are. This is much simpler than it might sound. We'll add a section on the lead detail form in SalesLogix that automatically shows whether the current lead is "LinkedIn", meaning if we can find the lead in the LinkedIn network or not. We'll have a clickable link as well so the user can click it and go to the LinkedIn site and see the matches. The code for this will be as follows:

  1. Grab the first and last name of the lead in SalesLogix (and optionally the company name as well to further narrow the results)
  2. Form a URL for searching the LinkedIn site for the lead
  3. Get the HTML for the URL (which will contain the results of the search)
  4. Parse the HTML to determine the results of the search (e.g.: number of matches found, no matches found, or the SalesLogix user is not logged into LinkedIn)
  5. Update the screen to show the number of results found and provide a click able link. We'll use a single hyperlink-style label for this, displaying the results in the caption of the label and place the URL we'll launch in the hint property of the label.
We'll use XMLHTTP to programatically retrieve the HTML for the LinkedIn search results page. One cool thing about the code is that we'll make the call asynchronously so that the call to the LinkedIn site doesn't slow down the opening of the lead detail form. We don't want the form to take too long to load while it waits for the results from LinkedIn in the case of a slow connection or problems on the LinkedIn site. The way this will be done is we will use VBScript's GetRef function to give a pointer to a function in our script that XMLHTTP will invoke once the process is complete. This will "simulate" a threaded call inside of VBScript and make our process run separately from the "loading" of the lead detail form. One more thing to mention about doing this from SalesLogix. Even though your login for LinkedIn is remembered when you go to the site from a browser, this won't be the case for our code in SalesLogix. We'll need to initiate the login from SalesLogix so that it is associated with the application and we'll have our own cookie. To do this, I used a hidden browser control on the lead details. If a login is needed I show the browser and load the login page in it for the LinkedIn site. After the first time the user logs in from the embedded browser in SalesLogix, they'll be automatically logged in every time after that.


Retrieving the LinkedIn Search Results

As I mentioned before, we'll be using XMLHTTP to retrieve the results. We'll also be making the call asynchronously. We don't necessarily have to do it that way, but we don't want to slow things down while we wait for the results, so this will provide a better user experience. Let's look at the code:

Dim xmlhttp

Sub CheckLinkedIn
Dim url

    Set xmlhttp = CreateObject("Msxml2.XMLHttp")
    ' use the values from the nedName control holding the lead name
    url = "http://www.linkedin.com/ns?search=&name=" & nedName.NameFirst & "+" & nedName.NameLast
    ' optionally use the company name to further narrow down the search
    If chkUseCompany.Checked Then url = url & "&company=" & Replace(txtCompany.Text, " ", "+")

    ' we'll use a label to show the results and also store the URL (so we can load that if clicked)
    ' store the URL in the hint property
    lnkGotoLinkedIn.Caption = "Retrieving LinkedIn status"
    lnkGotoLinkedIn.Hint = url

    With xmlhttp
        'open request async (passing False as the 3rd param tells it to do this asynchronously)
        .Open "GET", url, False
        'register callback function. Using VBScript's "GetRef" function we can pass a
        'pointer to the function we want invoked when complete 
        .OnReadyStateChange = GetRef("HandleLinkedInCallback")
        'send request
        .Send
    End With
End Sub

' This is the callback function that will be invoked by XMLHTTP when complete
Sub HandleLinkedInCallback
Dim result
Dim count
Dim i

    With xmlhttp
        If .ReadyState = 4 Then

            ' get the HTML from the request so we can parse it
            result = xmlhttp.ResponseText

            If InStr(1, result, "noresults", 1) <> 0 Then
                ' no matched results
                lnkGotoLinkedIn.Caption = "No matches found"
            ElseIf InStr(1, result, "we found", 1) <> 0 Then
                ' results found, parse the number of results out of the HTML
                i = InStr(1, result, "<strong name=""numResults"">", 1) + 26
                count = Mid(result, i, InStr(i, result, "</strong>", 1) - i)
                lnkGotoLinkedIn.Caption = count & " LinkedIn matches found"
            ElseIf InStr(1, result, "login-nonuser", 1) <> 0 Then
                ' not logged into LinkedIn
                menuLinkedIn.Items.Items(1).Enabled = False
                lnkGotoLinkedIn.Caption = "Log-in"
                lnkGotoLinkedIn.Hint = "https://www.linkedin.com/secure/login"
            Else
                ' something else went wrong - maybe LinkedIn has changed the search results page
                menuLinkedIn.Items.Items(1).Enabled = False
                lnkGotoLinkedIn.Caption = "Error processing LinkedIn status"
                lnkGotoLinkedIn.Hint = "http://www.linkedin.com/"
            End If
        End If
    End With
End Sub

All we need to do now is call "CheckLinkedIn" from the change event of the Lead Detail form so it is invoked with each change in Lead. When we tie that up to some elements on the screen it will end up like this:



If a match is made, we can click the link to see the match on the LinkedIn site:



We'll also be able to see when no matches are made:



And also when the user is not logged in to the LinkedIn site:



If the user is not logged into the LinkedIn site, we invoke the embededed browser to allow the user to sign-in.



Once the user has done this we'll have a cookie for the site and will be automatically logged in from then on. The sample LinkedIn integration bundle (for v7 only, no leads area in prior versions) that accompanies this article (see related section below) provides a more or less complete view of matching up SalesLogix leads with LinkedIn results.


Wrapping it up

This article shows a few different topics for developing in SalesLogix. The use of XMLHTTP and screenscraping, which certainly could be used for other integrations as well, and making an asynchronous call to retrieve the HTML ressults of the search. Best of all is the integration with LinkedIn to make your SalesLogix leads more meaningful.

Until next time, happy coding.
-Ryan

 

About the Author

  Ryan Farley
(SalesLogix Business Partner)
Customer FX Corporation

fiogf49gjkf0d

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

View Ryan's SalesLogix Mobile Seveloper Series
View Ryan's SalesLogix SData Developer Series
View Ryan's Git for the SalesLogix Developer series



View online profile for Ryan Farley
 

[ back to top] [ send to a friend]  

Rate This Article you must log-in to rate articles. [login here] 
 
Please log in to rate article.
 

Related Articles 
 - Integrating SalesLogix Leads with LinkedIn Sample Bundle - Submitted by: Ryan Farley

 

Comments & Discussion you must log-in to add comments. [login here] 
 
Author Article Comments and Discussion
Bob (RJ)Ledger

slxdeveloper.com Forum Top 10 Poster!

Re: Integrating SalesLogix Leads with LinkedIn
Posted: 6/20/2007 7:59:45 AM
fiogf49gjkf0d
Really HOT!

Added it to a test system.. and Immediately added it to the Production Slx system!

--
rjl
 
Ted Sturr



Re: Integrating SalesLogix Leads with LinkedIn
Posted: 9/7/2007 9:37:58 AM
fiogf49gjkf0d
Hi Ryan - cool stuff. Just one question about using it with IE7. Every time you click it opens another instance of IE instead of using tabs. Actually it would be even better if it knew that there was already a window pointing to the linked in site - but that is probably mor difficult to manage. Is there anything to make the link "tab aware"?
Thanks.
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: Integrating SalesLogix Leads with LinkedIn
Posted: 9/10/2007 12:24:07 AM
fiogf49gjkf0d
Hi Ted,

To change the behavior of how the links open, you'd replace the call to Application.BasicFunctions.WebOpen with some other code. Unfortunately, there's not much exposed as far as controlling opening new tabs in IE. Your best bet would be to open the link in an existing IE window. This doesn't mean it will open in a new tab, but would more than likely be an annoyance as it would cause already opened windows to navigate away from their pages to something else. To do this you'd also have to use IE automation, which would force this to work with IE only, no Firefox or anything else.

-Ryan
 
Vincent
 

Re: Integrating SalesLogix Leads with LinkedIn
Posted: 5/8/2008 2:54:35 AM
fiogf49gjkf0d
Brilliant to have this info within SLX.
Can this also be added to the main contact screen as well, or only within the leads section?

Also, due to a more open API since this code was submitted, would it now be possible to actually import any of the contact details from LinkedIN into SLX?
 
 

       Visit the slxdeveloper.com Community Forums!
Not finding the information you need here? Try the forums! Get help from others in the community, share your expertise, get what you need from the slxdeveloper.com community. Go to the forums...
 



 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2017 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 12/18/2017 12:39:27 PM