You need to sign in to do that
Don't have an account?
Michael Haddad.ax365
How do I call create on an array of sObjects with RForce?
I'm having trouble calling binding.create on an array of sObjects using the RForce gem for Ruby. Does anyone have sample code for this?
This doesn't seem to work:
newLeads = []5.times do newLeads.push({:type => "Lead", :lastName => "Jackson", :company => "Salesforce"})endbinding.create(:sObject => newLeads)
Although it works for a single sObject.
Thanks!
Michael
Hi Michael,
I'm part of the team that is maintaining ActiveSalesforce and RForce, mostly focusing on community development and project management.
Most of the developers who could help you out with your question (including Ian Dees, the creator of RForce) are members of our ActiveSalesforce Google Group:
I would recommend joining the group (I'm a moderator so I can let you in :-) and posting your question there.
I'd also recommend posting your question to the RForce project forum on RubyForge:
http://rubyforge.org/forum/?group_id=906
Unfortunately I'm not (yet!) a real Ruby developer (just a lowly Salesforce.com developer :-P), so I can't really provide you an answer myself.
Hope to see you on the group!
-Alex
I figured this out.
lead1 = {:lastName => "Jackson", :company => "Salesforce"}
lead2 = {:lastName => "Smith", :company => "Salesforce"}
array = ["sObject {'xsi:type' => 'Lead'}", lead1, "sObject {'xsi:type' => 'Lead'}", lead2]
binding.create(array)