Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To bulkify the API operations, wrap the request in another array with some consistent symbol (i.e. <code>:sObjects</code>) as the key for each value. The same symbol should be repeated before each value, as this gets converted into the repeated XML child elements. For example, if you want to create two opportunities, do this: </p> <pre><code>opportunity1 = [ :type, 'Opportunity', :amount, '10.00', :name, 'OPP1', :closeDate, '2008-07-04', :stageName, 'Closed Won' ] opportunity2 = [ :type, 'Opportunity', :amount, '10.00', :name, 'OPP2', :closeDate, '2008-07-04', :stageName, 'Closed Won' ] puts binding.create([:sObjects, opportunity1, :sObjects, opportunity2]) </code></pre> <p>This XML is created behind the scenes and sent to SFDC:</p> <pre><code>&lt;create xmlns="urn:partner.soap.sforce.com"&gt; &lt;sObjects&gt; &lt;type&gt;Opportunity&lt;/type&gt; &lt;amount&gt;10.00&lt;/amount&gt; &lt;name&gt;OPP1&lt;/name&gt; &lt;closeDate&gt;2008-07-04&lt;/closeDate&gt; &lt;stageName&gt;Closed Won&lt;/stageName&gt; &lt;/sObjects&gt; &lt;sObjects&gt; &lt;type&gt;Opportunity&lt;/type&gt; &lt;amount&gt;10.00&lt;/amount&gt; &lt;name&gt;OPP2&lt;/name&gt; &lt;closeDate&gt;2008-07-04&lt;/closeDate&gt; &lt;stageName&gt;Closed Won&lt;/stageName&gt; &lt;/sObjects&gt; &lt;/create&gt; </code></pre> <p>and here is the response for the two opportunities being created at once:</p> <pre><code>{:createResponse=&gt;{:result=&gt;[{:id=&gt;"0066000000KNMrOAAX", :success=&gt;"true"}, {:id=&gt;"0066000000KNMrPAAX", :success=&gt;"true"}]}} </code></pre> <p>Note, you can create up to 200 records at a time.</p> <p>Also, I noticed that if the two values are the same exact object (i.e. doing something like <code>binding.create([:sObjects, opportunity1, :sObjects, opportunity1])</code>, the XML converter freaks out, so make sure they are actually separate objects. This is probably a bug in the framework, but it is such a rare case in actual production situations to be considered serious, but watch out for it while you are testing.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload