+ Reply to Thread
Results 1 to 7 of 7

Thread: PHP Toolkit implementation

  1. #1
    cmartin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    4

    PHP Toolkit implementation

    Hi Mike,

    Just wanted to start off by saying this forum is a great resource.

    I'm a serious newbie to the Salesforce API, and am just trying to get my footing. I've installed the php toolkit and can get the sample apps up and running, and I'm currently combing through your site and any other documentation I can find.

    Here's what I need to do:

    1) Get web-to-lead form submissions going to Salesforce, creating new users and, if the user already exists (validating by email, preferably) updating the existing record.
    2) After a user has been created, set up a mechanism to allow them to bypass other web-to-lead forms on the site to get the deliverable more easily. Either by pre-filling the form fields with their data from Salesforce, or by bypassing the form altogether.

    I'm sure (or, I should say, I'm hoping) these are relatively basic scenarios. Any help you can provide in getting me on the right track for setting them up would be greatly appreciated.

    Thanks,
    Chris

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    Chris,

    Sorry for the delay, I was off work and away from the web for a few days. I can help you as much as possible, but I need some more informations. Are leads considered users? or are you talking about adding users to the user table?

    Sorry, just trying to make sure that I understand your requirements


    ~Mike

  3. #3
    cmartin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    4
    Sorry - yes, Leads. Apologies for mixing terms. I've made a fair amount of progress in the last couple days, so I actually have a specific issue for you to review.

    Right now I'm attempting to use the query function to pull out a specific lead, and then assign each of the values for that lead to a variable to be used elsewhere. I've got the query working based on the sample file from the toolkit, but am stuck on getting each value assigned to a separate variable. Here's the code I'm currently using:

    $email = $_REQUEST['email'];

    require_once ($docroot . SOAP_CLIENT_BASEDIR . '/SforceEnterpriseClient.php');
    try {

    $mySforceConnection = new SforceEnterpriseClient();
    $mySoapClient = $mySforceConnection->createConnection($docroot . SOAP_CLIENT_BASEDIR . '/enterprise.wsdl.xml');
    $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

    $query = "SELECT FirstName,LastName,Company,Street,City,State,Posta lCode,Country,Phone,Title from Lead WHERE Email = '" . $email . "' LIMIT 1";
    $response = $mySforceConnection->query($query);

    foreach ($response->records as $record) {

    print_r($record);
    print_r("<br>");

    }

    } catch (Exception $e) {

    echo $e->faultstring;

    }

    So, I'm passing the email in, running the query based on that, and getting all the data back. What do I need to do to separate the values?

    Thanks,
    Chris

  4. #4
    cmartin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    4
    And, of course, as soon as I enter my question I find this post: How do I select one record and display the result.

    So, I'm all good for now. Thanks for the help - again, this is a terrific resource.

    I'll let you know if I run into further issues.

    Thanks,
    Chris

  5. #5
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    Glad you found it and thanks!!!

  6. #6
    cmartin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    4
    Hi Mike,

    I'm back with a couple questions for you:
    1) On the forms I'm using I have a comment field. For that field, rather than completely overwriting the value if the lead already exists, I'd like the field to be updated with the new value. So, for example, a lead has a comment of "Thanks!" The same lead returns to the site and fills out another form - all of their demographic information is overwritten with the new values except for the comment field, which becomes (using 3 pipes as a separator) "This is a great site! ||| Thanks!" Any idea how I can make that happen?
    2) As another phase of this project I need to track browsing history in the lead record. Is there an easy way to integrate the Salesforce Tracking Code into the toolkit? Or do you have another suggestion for how I might manage that?

    Thanks,
    Chris

  7. #7
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    Quote Originally Posted by cmartin View Post
    Hi Mike,

    I'm back with a couple questions for you:
    1) On the forms I'm using I have a comment field. For that field, rather than completely overwriting the value if the lead already exists, I'd like the field to be updated with the new value. So, for example, a lead has a comment of "Thanks!" The same lead returns to the site and fills out another form - all of their demographic information is overwritten with the new values except for the comment field, which becomes (using 3 pipes as a separator) "This is a great site! ||| Thanks!" Any idea how I can make that happen?
    2) As another phase of this project I need to track browsing history in the lead record. Is there an easy way to integrate the Salesforce Tracking Code into the toolkit? Or do you have another suggestion for how I might manage that?

    Thanks,
    Chris

    Chris,

    Off the top of my head, this may work:

    1) You could do live SOQL query to get the description field from the record you are updating, before you send the updated information. Then you could get the value of the field prior to updating it. Store it in a temp variable, then concatenate the original value into the new value, separating it with | if you wish. That is one way of handling it

    2) Not sure on this one. Maybe you could do this via JavaScript and get the information that way. I guess it really depends on what information you are trying to do. you could also use PHP sessions and get the information that way, then store that into your object in Salesforce.


    ~Mike

+ Reply to Thread

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.1