Thread: Using update()
View Single Post
  #1  
Old 07-08-2008, 11:03 AM
CountRugen CountRugen is offline
Junior Member
 
Join Date: Jul 2008
Posts: 3
Using update()

Hi Mike,
great site. Very helpful!
I used the thread at Update Contact Description
to help me run update commands, with a few minor modifications.

Here's what I am running:
PHP Code:
ini_set("soap.wsdl_cache_enabled","0");
$username 'my@email.com';
$password 'mypassword';
$date date("m/d/y");

require_once (
'../includes/soapclient/SforceEnterpriseClient.php');
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient $mySforceConnection->createConnection("../includes/soapclient/enterprise.wsdl.xml");
$mylogin $mySforceConnection->login($username,$password);

try
{
    if (
$mylogin) {
        
$query "select Id";
        
$query .= " from Account";
        
$query .= " where Account.WebID__pc=22";

        
$queryResult $mySforceConnection->query($query);
        
$records $queryResult->records;

        foreach (
$records as $record)
        {
            echo 
'<pre>' print_r($record,true) . '</pre>';
            
//$sObjectContact = new sObject();
            
$sObjectContact->type 'Account';
            
$sObjectContact->Id $record->Id;
            
$sObjectContact->fields = array('FirstName' => 'Shano');
            
print_r($sObjectContact);
            
$result $mySforceConnection->update(array($sObjectContact));
            
// print_r($result);
            
if ($result->success)
            {
                echo 
"good";
            }
            else
            {
                echo 
"bad";
            }
        }


    }
    else
    {
        echo 
"crap, something is wrong";
    }
}
catch (
exception $e)
{
    echo 
$mySforceConnection->getLastRequest();
    echo 
$mySforceConnection->getLastRequestHeaders();
    echo 
'<pre>' print_r($e,true) . '</pre>';

and when I do I get the following error to my browser. Can you help me work out what needs to be done to overcome this?

Warning: Missing argument 2 for SforceEnterpriseClient::update(), called in /mounted-storage/home94a/sub004/sc49409-VDPR/www/member/member4.php on line 30 and defined in /mounted-storage/home94a/sub004/sc49409-VDPR/www/includes/soapclient/SforceEnterpriseClient.php on line 68
462200D70000000Ij6O!AQkAQN31N.N3Gevi0l18_N8u3NY1pK GBi4JvGiePTVyZzvzBEuJr0WUAaXDQj.Va0AaxO8rohbTOBWMH k7Ij9jdCNIBGdmT8Contact0017000000NqhHZAAZFirstName Shano POST /services/Soap/c/13.0/462200D70000000Ij6O HTTP/1.1 Host: na5-api.salesforce.com Connection: Keep-Alive User-Agent: PHP-SOAP/5.2.3 Accept-Encoding: gzip, deflate Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 604
Thanks
Count Rugen
Reply With Quote