在 salesforce.com 中,您可以拥有多值属性吗?
我正在为 Salesforce.com 开发 Novell Identity Manager 驱动程序,并试图更好地了解 Salesforce.com 平台。
迄今为止,我已经取得了非常好的成功。我可以从 SFDC 中读取几乎任意对象类,并为它们创建 eDirectory 对象,等等。这一切都已完成并且运行良好。 (出版商频道)。一旦我映射了查询事件,大多数事情就开始在发布商渠道中工作。
我现在正在努力在 eDirectory 中发生更改时将事件发送回 SFDC(订阅者通道)。
我在 SOAP API 中使用 upsert() 函数,并且使用 Novell Identity Manager,您基本上可以构建 SOAP 文档,并且可以在构建时看到结果。 (您可以在 XSLT 中执行此操作,也可以使用各种允许的标记在 DirXML 脚本中构建文档。我正在使用 DirXML 脚本,到目前为止它运行良好。)。
该评论的结果是我可以构建 SOAP 文档,查看它,以确保我做对了。这通常与示例代码通常提供的 Java/C++ 方法不同。这样更加直观。
关于 upsert() 有几件事我不完全理解。如果我收到此类事件,我知道如何清空一个值。在
节点内,添加一个如下节点(假设您已经声明了命名空间):
我知道如何向属性 (FieldName) 添加值 (AttrValue),添加一个节点,例如:
所有这些都有效,而且非常简单。
我的问题是,SFDC 中的值可以是多值的吗?在 eDirectory 中,可以通过两种方式更改多值属性:
- 可以删除所有值,然后重新添加新集。
- 删除的单个值可以作为此类事件(删除值)发送,也可以在一次操作中删除多个值。
查看 SFDC,我只看到似乎存储在单个条目中的多选项列表属性:或;划定的。 SFDC 中是否有另一种以不同方式管理的多值属性?如果是这样,如何通过 SOAP API 对其进行操作?
我仍然必须决定是否要将这些多选项列表映射到单个字符串,还是字符串的多值属性。第一种方法更容易,第二种方法更有用...嗯...选择...
一些参考资料:
- 我一直在使用页面 示例 SOAP 消息以了解文档应该是什么样子。
- Apex Explorer 是一个用于浏览数据库和测试查询的踢工具。与 DBVisualizer 对于 JDBC 连接数据库的作用非常相似。如果没有它,这将变得更加困难!
- SoapUi 也是必需的,而且是一个可爱的工具!
I am developing a Novell Identity Manager driver for Salesforce.com, and am trying to understand the Salesforce.com platform better.
I have had really good success to date. I can read pretty much arbitrary object classes out of SFDC, and create eDirectory objects for them, and what not. This is all done and working nicely. (Publisher Channel). Once I got Query events mapped out, most everything started working in the Publisher Channel.
I am now working on sending events back to SFDC (Subscriber channel) when changes occur in eDirectory.
I am using the upsert() function in the SOAP API, and with Novell Identity Manager, you basically build the SOAP doc, and can see the results as you build it. (You can do it in XSLT or you can use the various allowed tokens to build the document in DirXML Script. I am using DirXML Script which has been working well so far.).
The upshot of that comment is that I can build the SOAP document, see it, to be sure I get it right. Which is usually different than the Java/C++ approach that the sample code usually provides. Much more visual this way.
There are several things about upsert() that I do not entirely understand. I know how to blank a value, should I get that sort of event. Inside the <urn:sObjects>
node, add a node like (assuming you get your namespaces declared already):
<urn1:fieldsToNull>FieldName</urn1:fieldsToNull>
I know how to add a value (AttrValue) to the attribute (FieldName), add a node like:
<FieldName>AttrValue</FieldName>
All this works and is pretty straight forward.
The question I have is, can a value in SFDC be multi-valued? In eDirectory, a multi valued attribute being changed, can happen two ways:
- All values can be removed, and the new set re-added.
- The single value removed can be sent as that sort of event (remove-value) or many values can be removed in one operation.
Looking at SFDC, I only ever see Multi-picklist attributes that seem to be stored in a single entry : or ; delimited. Is there another kind of multi valued attribute managed differently in SFDC? And if so, how would one manipulate it via the SOAP API?
I still have to decide if I want to map those multi-picklists to a single string, or a multi valued attribute of strings. First way is easier, second way is more useful... Hmmm... Choices...
Some references:
- I have been using the page Sample SOAP messages to understand what the docs should look like.
- Apex Explorer is a kicking tool for browsing the database and testing queries. Much like DBVisualizer does for JDBC connected databases. This would have been so much harder without it!
- SoapUi is also required, and a lovely tool!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,除了多选选项列表之外,没有多值字段(它们映射到分号分隔的字符串)。一般来说,如果您需要将多个值与数据关联,平台会鼓励您与另一个(可能是新的、自定义的)表创建适当的关系。
我能想到的唯一“不寻常”的事情是如何使用某些对象(案例、领导,也许其他)上的 OwnerId 字段来指向用户或队列记录。当您习惯传统数据库中的外键关系时,看起来很奇怪。但这与您所要求的并不相同,因为一次只有一个值。
当然,有时您可能会对数据库中看到的值感到惊讶,具体取决于查看用户的区域设置(例如系统管理员配置文件在荷兰语中变为 Systeembeheerder)。但这仍然是一个值,在查询结果发送回给您之前即时转换。
当我必须与 SFDC 执行 SOAP 集成时,我总是使用 WSDL 文件,并且大多数时候使用 Apache Axis 从这些文件生成的 Java 代码就可以了。自己手工制作 SOAP 消息似乎...哇,有点硬核。您确定您更喜欢 XML 的可视化而不是创建类、异常以及所有这些准备好与几个开箱即用的集成方法?如果他们要更改 WSDL,我只需要从中重新生成类即可;而更改 SOAP 消息创建库可能会很痛苦......
As far as I know there's no multi-value field other than multi-select picklists (and they map to semicolon-separated string). Generally platform encourages you to create a proper relationship with another (possibly new, custom) table if you're in need of having multiple values associated to your data.
Only other "unusual" thing I can think of is how the OwnerId field on certain objects (Case, Lead, maybe something else) can be used to point to User or Queue record. Looks weird when you are used to foreign key relationships from traditional databases. But this is not identical with what you're asking as there will be only one value at a time.
Of course you might be surpised sometimes with values you'll see in the database depending on the viewing user's locale (stuff like System Administrator profile becoming Systeembeheerder in Dutch). But this will be still a single value, translated on the fly just before the query results are sent back to you.
When I had to perform SOAP integration with SFDC, I've always used WSDL files and most of the time was fine with Java code generated out of them with Apache Axis. Hand-crafting the SOAP message yourself seems... wow, hardcore a bit. Are you sure you prefer visualisation of XML over the creation of classes, exceptions and all this stuff ready for use with one of several out-of-the-box integration methods? If they'll ever change the WSDL I need just to regenerate the classes from it; whereas changes to your SOAP message creation library might be painful...