0
<?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);

}


 ?>

此代码适用于将数据插入到 salesforce 中,并且我还能够将联系人访问我的网站。但我无法弄清楚如何在我的网站中获取产品并在 salesforce 中更新它。

请帮忙 ...

谢谢

4

1 回答 1

2

产品存储在Product2表中,检查哪些字段存在的最佳位置是您的 WSDL 或描述调用。

在线解释“什么是什么”仅适用于标准字段(显然,如果您创建了一些自定义字段,它们将不会出现在文档中): http: //www.salesforce.com/us/developer/docs/ api/Content/sforce_api_objects_product2.htm

要获取它们,您必须使用query()呼叫,这样的事情应该让您开始:

$queryString = 'SELECT Id, Name, ProductCode FROM Product2 ORDER BY Name LIMIT 10';
$products= $mySforceConnection -> query($queryString);
print_r($products);

从最后一个链接的文档中进一步阅读有关更新语句的文档,您应该能够连接所有点:)

于 2013-01-08T14:09:27.267 回答