Saturday, January 21, 2012

Use Apply With Linked In Salesforce Site


I am back after couple of months. Recently I started to look into the Linked in Salesforce integration. I found this very interesting & keep diging & finally implemented as web site page which is using apply with linked-on button. Here are the complete steps by which you can add “Apply with Linked In” button to your VF site.
1-go this below url & create a developer login on linked in-
https://www.linkedin.com/reg/join
2-Login with the linked-in password by below url
http://developer.linkedin.com/user/login
2-go to below url & click on “Create On API Key” link
https://developer.linkedin.com/apply-getting-started

3-You will see a page as below.


Click on “Add New Application” Link, fill all the values in the next form & in the “JavaScript API Domain:” text box enter your site url. For Eg In my case it was “http://kgblog-developer-edition.ap1.force.com/apex/ApplyWithLinkedIn”
Click on save & you will see some information on the page, something like api key, secret key etc. do not close this window, it will be used in next step.




4-Now go to below url 
https://developer.linkedin.com/plugins/apply & click on Get Code button. You will see something link as below-
<script src="http://platform.linkedin.com/in.js" type="text/javascript">
  api_key: YOUR_API_KEY
</script>
<script type="IN/Apply" data-companyid="XXXX" data-jobtitle="test" data-email="XXXXX@yahoo.com"></script>
Copy this js code & put it in your vf page. 
Replace api key in above code which we get step-3.
5-now run the site page, you will see apply with linked button on your page.
If you are building an application in which you need some input something like name, email & some other information from the linked site than you can use “apply with linked in” button .

 <script type="IN/Apply" data-companyid="XXXX" data-jobtitle="Manager" data-joblocation="Delhi" data-callback="onCallBack" ></script>
& the js method will be as below



<script>


        function onCallBack(p1,p2) {
            document.getElementById("txt1").value = p1.person.firstName;
            document.getElementById("txt2").value = p1.person.lastName;
            document.getElementById("txt3").value = p1.person.emailAddress;
            document.getElementById("txt4").value = p1.person.publicProfileUrl;
         
        }
     
</script>


take a look of the demo by below url