如何处理Dynamics CRM API中的选项集?

时间:2017-11-29 09:19:37

标签: ruby-on-rails ruby dynamics-crm

我使用此gem将我的平台连接到Dynamics CRM API。 我有一个属性neos_titre,这是我的用户的文明,在Dynamics中,这个属性是OptionSet,需要用整数设置。 但是创建一个用户:

client.create('contact', firstname: 'test', neos_titre: 115170001)

返回以下错误:

DynamicsCRM::XML::Fault: s:Sender[] Incorrect attribute value type System.Int32

所以我不知道如何设定这个值,有人可以帮助我吗?

2 个答案:

答案 0 :(得分:0)

原生CRM Sdk中应为new OptionSetValue(115170001)

当我在git client.rb文件中检查以下实现时,我觉得它不见了。

# These are all the operations defined by the Dynamics WSDL.
# Tag names are case-sensitive.
def create(entity_name, attributes)
  entity = XML::Entity.new(entity_name)
  entity.attributes = XML::Attributes.new(attributes)

  xml_response = post(organization_endpoint, create_request(entity))
  Response::CreateResult.new(xml_response)
end

您可以将其分叉以添加此内容或与贡献者联系。

答案 1 :(得分:0)

好的,我终于找到了解决方案。

适用于:

client.create('contact', lastname: 'test', neos_titre: {type: "OptionSetValue", value: 115170000})

谢谢大家