function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael Haddad.ax365Michael 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 

apexsutherlandapexsutherland

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:

 

http://groups.google.com/group/activesalesforce

 

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  

Michael Haddad.ax365Michael Haddad.ax365

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)