How can I create multiple records at once?
Building off of the example, I've tried passing create an array of opportunities like:
binding.create :sObject => array_of_opportunities
Which throws this error:
NoMethodError (undefined method `to_sym' for #Array:0x00000004ba5488)
I'd appreciate any help.
Hi, mrpersister.
I'm not sure how to do this. For the hairier API cases, it can help to start with an example of a working XML payload and work back to Ruby. I've written a couple of SalesForce API experts to ask if they can show me what this needs to look like in XML, so that we can translate it to Ruby.
--Ian
See my response on Stack Overflow for the solution to this issue: http://stackoverflow.com/questions/8857318/ruby-rails-how-can-i-create-multiple-records-in-salesforce-with-one-api-call/9061028#9061028
Thanks, Ryan!
James, the key that Ryan brings up is to have multiple :sObjects, value pairs in the array, like so:
binding.create([:sObjects, opportunity1, :sObjects, opportunity2])
Since you're the originator of the StackOverflow question, would you mind marking Ryan's answer there as accepted? (And I'll award the bounty as soon as the system lets me.)