English 中文(简体)
鲁比拉/铁路:我如何能够在销售力中制作多份记录,并通过大街号发出一份标语?
原标题:Ruby / Rails: how can I create multiple records in salesforce with one API call via the rforce gem?

使用rforcegem在我的销售力量数据库中制作记录。

制作部队文件记录的例子有:

  opportunity = [
                 :type,       Opportunity ,
                 :accountId, account_id,
                 :amount,     10.00 ,
                 :name,       Fakey McFakerson ,
                 :closeDate,  2008-07-04 ,
                 :stageName,  Closed Won 
                ]

  binding.create :sObject => opportunity

销售商编号create(>)允许一劳永逸地制造多个物体,但我为实现这一目标而奋斗。 我听了以下呼吁:

binding.create :sObject => array_of_opportunities

Where array_of_opportunities is an array of arrays like opportunity in the example above.

but that throws an error:

NoMethodError (undefined method `to_sym  for #<Array:0x00000004ba5488>)

我感谢任何帮助。

最佳回答

为对APIC业务进行批量,将请求在另一阵列中进行总结,其编号为::sObjects,作为每个数值的关键。 每一数值之前都应重复同样的编号,因为这一编号已经变成了反复的《禁止种族歧视公约》中的儿童内容。 例如,如果你想创造两个机会,就这样做:

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])

这一XML是在幕后创建的,并寄给社会团结基金会:

<create xmlns="urn:partner.soap.sforce.com">
  <sObjects>
    <type>Opportunity</type>
    <amount>10.00</amount>
    <name>OPP1</name>
    <closeDate>2008-07-04</closeDate>
    <stageName>Closed Won</stageName>
  </sObjects>
  <sObjects>
    <type>Opportunity</type>
    <amount>10.00</amount>
    <name>OPP2</name>
    <closeDate>2008-07-04</closeDate>
    <stageName>Closed Won</stageName>
  </sObjects>
</create>

这里是两个机会的对策:

{:createResponse=>{:result=>[{:id=>"0066000000KNMrOAAX", :success=>"true"}, {:id=>"0066000000KNMrPAAX", :success=>"true"}]}}

请注意,你可以随时制作多达200份记录。

而且,我注意到,如果这两个数值相同(即,如<代码>具有约束力.create([:s.])。 物体、机会1、:sObjects, opportunity1],XML换算器可拆解,从而确保它们实际上是单独的物体。 这可能是框架中的ug缩,但在实际生产情况下,这种罕见的情况被认为是严重的,但在你进行测试时就看着。

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签