[英]Can I create two entities and then a third linking entity atomically using Web API in Dynamics?
I'm developing a NodeJS app which queries Dynamics 365 using the Web API (oData). 我正在开发一个NodeJS应用程序,该应用程序使用Web API(oData)查询Dynamics 365。
I need to create an account
entity, a contact
entity and then a connection
entity which will link the two together. 我需要创建一个account
实体,一个contact
实体,然后创建一个将两者链接在一起的connection
实体。 I would like this to happen atomically so that if any of these fail, then they all fail. 我希望这是原子发生的,因此,如果其中任何一个失败,那么它们都会失败。
The connection
entity needs to know the accountid
and contactid
in advance, which means it must occur after the creation of the account
and the contact
该connection
实体需要知道accountid
和contactid
提前,这意味着它在创建后必须进行account
和contact
I'm aware of the batch command which lets you create multiple entities atomically but it does not look like I can pass the result of one request to the payload of another. 我知道批处理命令可以让您原子地创建多个实体,但是看起来我无法将一个请求的结果传递给另一个请求的有效负载。
Is it possible to do such a request atomically over a web interface and if not, what fallbacks could I use to approximate atomic transactions? 是否可以通过Web界面自动进行这样的请求,如果没有,我可以使用哪些后备来近似原子交易?
If I understand it correctly - You should be able to achieve this by Deep insert . 如果我正确理解-您应该可以通过Deep insert来实现。
Part 3 of my answer in this SO thread talks about reading the returned id & using in next api call. 我在这个SO线程中回答的第3部分讨论了读取返回的ID和在下一个api调用中使用的方法。 It may help your atomic record creation scenarios. 它可以帮助您创建原子记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.