+ Reply to Thread
Results 1 to 5 of 5
This is a discussion on How can I get the Lead Module Fields information from Salesforce to Joomla website within the Salesforce PHP Tutorials forums, part of the Salesforce category; Hi, I am a Joomla Developer and new to Saleforce. I am
  1. #1
    ameen is offline Junior Member
    Join Date
    Oct 2010
    Posts
    4

    How can I get the Lead Module Fields information from Salesforce to Joomla website

    Hi,

    I am a Joomla Developer and new to Saleforce. I am working on Fields Synchronization to setup a lead form dynamically in my website. I am trying to get the Field information like field name, field type etc used in my Salesforce Lead Module into my Joomla website. i.e when I click a button in my Joomla website all the Lead fields information from the Salesforce Crm database should store into my joomla database

    Please let me know how can I get the Field information data with the help of Api or is there any other method available to get this done .

    Please help me.

    Thanks & Regards
    Ameen
    Last edited by ameen; 10-19-2010 at 10:25 AM.

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    So you have lead information that you want to get from Salesforce onto a page within Joomla. I am not that experienced with Joomla, but it should be pretty straight forward.

    You need to download the salesforce php toolkit, which you can access from my menu on the front page.

    Then you need to get that setup and make sure you can connect to salesforce's API from the server that you are trying to query.

    Then some simple code:

    PHP Code:
    <?php
    //set this to make sure your not caching the WSDL
    ini_set("soap.wsdl_cache_enabled""0");

    //make sure you change this to match your path to the partner client from the php tool kit
    require_once ('./includes/soapclient/SforcePartnerClient.php');

    //make sure you change this to match your path to the partner client from the php tool kit
    $wsdl './includes/soapclient/partner.wsdl.xml';
    $userName "username";
    $password "password";
    $key 'yourkey';

    $password $password $key;

    $lead_data = array();
    //setup connection
    $client = new SforcePartnerClient();
    $client->createConnection($wsdl);
    $loginResult $client->login($userName,$password);

    //SOQL query for Object in Salesforce change this to whatever you want to query
    $soql "Select Id, name FROM Lead";

    $records get_records($client$soql);

    foreach (
    $records as $r)
    {
        
    $lead_data['id'] = $r->Id;
        
    $dwin_data['name']  = $r->fields->Name;
        
        
    //use this to look at the data coming in 
        
    echo '<pre>' print_r($rtrue) . '</pre>';
    }


    //function to get records from Salesforce
    function get_records(&$connection, &$query)
    {
        
    $queryOptions = new QueryOptions(2000);

        
    $response = new QueryResult($connection->query($query));
        
    // if the size is zero, where done
        
    if ($response->size 0)
        {
            
    $products $response->records;
            
    // Cycles through additional responses if the number of records
            // exceeds the batch size
            
    while (!$response->done)
            {
                
    set_time_limit(100);
                
    $response $connection->queryMore($response->queryLocator);
                
    $products array_merge($products$response->records);
            }
        }
        return 
    $products;
    }
      
    ?>

    that should get you started

    ~Mike

  3. #3
    ameen is offline Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Hi Mike,

    Thank you very much for your prompt reply.

    I have downloaded the phptoolkit and made the setup.

    I just need to know which username, password and key I should give in the variables and also let me know where can I find the key ?
    $userName = "username";
    $password = "password";
    $key = 'yourkey'

    Thanks & Regards
    Ameen
    Last edited by ameen; 10-20-2010 at 12:39 AM.

  4. #4
    ameen is offline Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Hi Mike,

    Again Thanks for you help, I Managed to find the username, password and key to be used in Api. This is great. Now my connection is established with the salesforce.com.
    Now what I need is the query to get the details for Fields used in my Salesforce.com Lead Form example Firstname, Lastname, CustomField1, CustomField2 and so on. I need to fetch the information of fields used in lead form like field name, field type and so on in order to generate those fields automatically and setting up a lead form in my website using those information.

    If I use $soql = "Select Id, name FROM Lead"; it is fetching the submitted lead data.

    I need the information to fields used in the lead form. So please help me with query to get these information.

    Thanks & Regards
    Ameen
    Last edited by ameen; 10-20-2010 at 03:15 AM.

  5. #5
    Adam Best is offline Junior Member
    Join Date
    Apr 2011
    Posts
    10
    Hi Ameen,

    It seems to me that you want to Dynamically get the Field Names of all fields for a SalesForce Object. In this case, it's the Lead Object.

    Use the DescribeSObject. See this page for a sample of how to do this.
    PHP Toolkit 13.0 DescribeSObject Sample (Partner) - developer.force.com

    You might want to check out this page for joomla integration:
    miiJoomla Salesforce To Website Intergration

    A plug here of our Joomla/SalesForce Integration/Webforms you might be interested in:
    miiJoomla - SalesForce App, Joomla Extension - Integration
    Regards,
    Adam

    Into Joomla! and SalesForce?
    Check us out below at
    http://www.miiworks.com/

+ Reply to Thread

Similar Threads

  1. Salesforce in Web 2 lead
    By Van83 in forum Salesforce PHP Tutorials
    Replies: 1
    Last Post: 10-06-2010, 11:22 AM
  2. How to integrate salesforce.com report datas into MY WEBSITE (Leads on website)
    By aruljothi2011 in forum Salesforce PHP Tutorials
    Replies: 1
    Last Post: 06-03-2010, 05:20 PM
  3. Need Information on how to retrieve DISTINCT records?
    By chiranjeevi in forum Salesforce Coding Discussions
    Replies: 1
    Last Post: 07-14-2009, 11:43 AM
  4. Salesforce PHP script which lists all Objects and Fields
    By mike in forum Salesforce PHP Tutorials
    Replies: 2
    Last Post: 03-27-2009, 01:14 PM
  5. Web to lead help
    By ejayqueja in forum Salesforce Coding Discussions
    Replies: 2
    Last Post: 05-06-2008, 04:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2