+ Reply to Thread
Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 42
This is a discussion on Salesforce Code Example #1 within the Salesforce PHP Tutorials forums, part of the Salesforce category; Hi Mike, First I would like to thank you for your effort.
  1. #21
    saariko is offline Junior Member
    Join Date
    Feb 2009
    Posts
    10

    Thank you

    Hi Mike,

    First I would like to thank you for your effort. I am somewhat new to all this, but I am sure I will save lots of time by using your directions.

    For starters, the first line in your sample code here missed the
    <?php

    line, but that is neglected.

    As for the samples, I find it that learning things slowly and step by step is easier than a full load solution, and this is what I am doing now.

    I started with a check login script, and than slowly slowly I hope to get my full code to work.

    I will post anything I do here, and again, thanks.

  2. #22
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Hey again Saariko thanks for joining my site and adding some code examples!!! Anything helps....

    I look forward to looking at your examples, I am sure they will help me out

    ~Mike

  3. #23
    mevin is offline Junior Member
    Join Date
    Apr 2009
    Posts
    6
    Elo, i'm not able to make connection to oracle database. below is my conection:

    $cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)( PORT=$port)) (CONNECT_DATA=(SID=$sid)))";
    $_ret = $conn->Connect($cstr, "rpt", "rpt");

    The the function $conn->ErrorMsg() is not retrieving any error message and my remaining display messages after this function are not being displayed.

    Please anyone help me
    thx

  4. #24
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Mevin

    First thanks for joining the site!

    Listen I can see that you are using ADODB to connect to Oracle. Is the database at a remote location? It seems that way

    To me it looks like you need to check your ORACLE_HOME and LD_LIBRARY_PATH on your server or make sure that your OCI8 is enabled on the server, check your phpinfo() to see if that is set

    ~Mike

  5. #25
    mevin is offline Junior Member
    Join Date
    Apr 2009
    Posts
    6
    thanks for the reply..
    in fact i was able to solve the prob; it was my oci8 was not enable
    by setting the connection debug on; i was able to know where the prob was exactly.

    now i have another prob
    i have reduced the number of record to be processed at one time to 10; because of a trigger
    it process the first batch of 10 correctly
    but i get error with the next batch

    DIV P { MARGIN: 0px } Warning: Invalid argument supplied for foreach() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\main.php on line ***
    10 records processed.


    It is the foreach which is found in the function upsert_accounts

    I have displayed the $recordSet for the select statement; in the 1st batch I was able to see the database data but in the second I think it was pointing to null.

    Hope you can help me
    thks

  6. #26
    mevin is offline Junior Member
    Join Date
    Apr 2009
    Posts
    6
    elo mike
    I have been able to solve the issue; there was a prob in my count
    thx

  7. #27
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    okay cool Mevin I am glad that you got it worked out

  8. #28
    paul is offline Junior Member
    Join Date
    Jul 2009
    Posts
    2
    Hi Mike!

    I'm having a bit of trouble using the upsert. I have pretty much stripped much of your code because I'm not migrating data from one database to another. Instead I'll be inputting information from a form into SalesForce, but to make things simple I've provided the following code and the warning message. This is exactly what I'm using...

    PHP Code:

    ini_set
    ("soap.wsdl_cache_enabled""0");
    require_once (
    'soapclient/SforcePartnerClient.php');
    require_once (
    'soapclient/SforceHeaderOptions.php');
    $mySforceConnection = new SforcePartnerClient();
    $mySoapClient $mySforceConnection->createConnection("soapclient/partner.wsdl.xml");
    $mylogin $mySforceConnection->login("XXX@XXX.XXX""XXXX");

    $Array=array();
    $Array[0]['FirstName']='TEST123';
    $sObjects = array();
    foreach(
    $Array as $fieldset)
    {
        
    $sObject = new sObject();
        
    $sObject->type 'Lead'//SalesForce field or object you'll be working with
        
    $sObject->fields $fieldset;
        
    array_push($sObjects$sObject);
    }
    $results $mySoapClient->upsert("ExternalIdField__c"$sObjects);
    $k=0;
    foreach (
    $results as $result)
    {
        
    // Build string from fields in $sObjects array
        // At this point, the record has already been upserted
        // We just need the data for the log file
        // The string is the same, regardless of the result
        
    $data2 $sObjects[$k]->fields['NAME'] . ", " $sObjects[$k]->fields['SA_ID__C'];
        if (
    $result->success)
        {
            if (
    $result->created)
            {
                
    $accounts_created++;
                
    #file_put_contents($file_created, $data2 . "\n", FILE_APPEND);
                
    echo $data."<br />";
            }
            else
            {
                
    $accounts_updated++;
                
    file_put_contents($file_updated$data2 "\n"FILE_APPEND);
                echo 
    $data."<br />";
            }
        }
        else
        {
            
    $accounts_failed++;
            
    // The errors object also contains fields and status_code
            
    $errMessage $result->errors->message;
            
    #file_put_contents($file_failed, $data2 . ", " . $errMessage . "\n", FILE_APPEND);
            
    echo $errMessage."<br />";
        }
        
    $k++;

    And this is the error I'm getting.

    Uncaught SoapFault exception: [sf:INVALID_SESSION_ID] INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session in D:\xampp\htdocs\classes\salesforcephp\index.php:23 5 Stack trace: #0 [internal function]: SoapClient->__call('upsert', Array) #1 D:\xampp\htdocs\classes\salesforcephp\index.php(23 5): SoapClient->upsert('ExternalIdField...', Array) #2 {main} thrown in D:\xampp\htdocs\classes\salesforcephp\index.php on line 235

    As you can see I've stripped allot of it and echoed the results instead while only inserting 1 record in the FirstName. I've created the external field Id which is basically a text value that does not need to be unique with no default value. Is there anything I'm missing? The error is on the actual query call:

    PHP Code:
    $results $mySoapClient->upsert("ExternalIdField__c"$sObjects); 

  9. #29
    paul is offline Junior Member
    Join Date
    Jul 2009
    Posts
    2
    Bejeebus! I figured it out... *shakes head*

    I was using the wrong variable as the connection resource.

    Also upon further look, it might be more beneficial for me to use the create attribute. If I have problems with that... Can I ask ya?

  10. #30
    jeff is offline Junior Member
    Join Date
    Jul 2009
    Posts
    3
    Quote Originally Posted by mike View Post
    //this clears out your local PHP WSDL cache incase you may have been performing
    //tests against your development account or Sandbox account
    ini_set("soap.wsdl_cache_enabled", "0");
    require_once ('./includes/soapclient/SforcePartnerClient.php');
    require_once ('./includes/soapclient/SforceHeaderOptions.php');

    Hi,

    How do I switch from development to sandbox?

    Is the login/pw taking care of this.

    I want to push data to SF test environment.

    Thank you,
    Jeff

+ Reply to Thread
Page 3 of 5 FirstFirst 12345 LastLast

LinkBacks (?)

  1. Hits: 3
    12-03-2009, 12:47 PM
  2. Hits: 104
    09-25-2009, 09:57 AM
  3. Hits: 54
    03-16-2009, 03:47 AM
  4. Hits: 1
    11-16-2007, 04:10 PM
  5. Hits: 1
    05-18-2007, 10:46 PM
  6. Hits: 1
    05-18-2007, 01:45 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