我有这个代码片段,目前正在从Drupal页面向Salesforce添加一个带有一个产品的Opportunity。现在问题是我想在用户同时选择多个产品后创建一个包含多个产品的机会。
$fields = array(
'Name' => 'Adhesion - ' . $field_nom_adhesion . ' ' . $field_prenom_adhesion,
'Pricebook2Id' => 'sr3sdfxcvbwqe',
'AccountId' => $AccountId_Con,
'CloseDate' => $today,
'StageName' => 'Proposition/Devis',
'Cat_gorie_produit__c' => 'Adhésion',
'Source__c' => 'Site web',
'Statut_Adhesion__c' => str_replace("\'", "'", $field_statut_adhesion),
'Contact__c' => $ContactId_Opp
);
$sObject = new SObject();
$sObject->fields = $fields;
$sObject->type = 'Opportunity';
$sObject2 = new SObject();
$sObject2->fields = $fields;
$sObject2->type = 'Opportunity';
echo "<br/>**** Creating the following:\r\n";
$createResponse = $mySforceConnection->create(array(
$sObject
));