<?php
define("USERNAME", "abc@demo.com");
define("PASSWORD", "abc");
define("SECURITY_TOKEN", "aDyy0oukYSCsQ7qua7lgG85Jd");
require_once ('includes/soapclient/SforcePartnerClient.php');
$client = new SoapClient('http://url/index.php/api/soap/?wsdl');
$session = $client->login('ab', 'ab');
$result = $client->call($session, 'order.list');
echo "\n\n";
$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->createConnection("includes/soapclient/partner.wsdl.xml");
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
echo "<br><br>";
foreach($result as $res)
{
$records = array();
//print_r($result);
$records[0] = new stdClass();
$records[0]->fields = array(
'FirstName' => $res['firstname'] ,
'LastName' => $res['lastname'],
'Email' => $res['customer_email']
);
$records[0]->type = 'Contact';
$response = $mySforceConnection->create($records);
/*
print_r($response);
//echo "Full Record=". $res . "<br/>";
echo "<br/> Customer Details:<br/>";
echo "FirstName=". $res['firstname'] . "<br/>";
echo "LastName=". $res['lastname'] . "<br/>";
echo "Email=". $res['customer_email'] . "<br/>";
*/
}
$ids = array();
foreach ($response as $i => $result) {
/* echo $records[$i]->fields["FirstName"] . " "
. $records[$i]->fields["LastName"] . " "
. $result->id . "<br/>\n";*/
array_push($ids, $result->id);
}
?>
このコードは、セールスフォースにデータを挿入するために正常に機能し、自分のWebサイトへの連絡先を取得することもできます。しかし、自分のWebサイトで製品を取得し、Salesforceでも更新する方法を理解できませんでした。
助けてください ...
ありがとう