0

I'm developing a NodeJS app which queries Dynamics 365 using the Web API (oData).

I need to create an account entity, a contact entity and then a connection entity which will link the two together. 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

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?

Brendan
  • 18,771
  • 17
  • 83
  • 114
  • Yes it was, I have upvoted although hasn’t fully solved my problem, for example in my actual use case I need to create two connection entities atomically which I don’t think is possible this way. I’m leaving it open in case further answers bubble up – Brendan Feb 15 '19 at 22:26
  • Part 3 of my answer from the linked SO thread in my answer below talks about reading the returned id & using in next api call. It may help your atomic record creation scenarios. – Arun Vinoth-Precog Tech - MVP Feb 17 '19 at 05:30
  • Thanks, I've been playing around with deep insert for a bit but didn't get anywhere - @Arun do you think you could comment [on this new question I posted](https://stackoverflow.com/questions/54790306)? – Brendan Feb 20 '19 at 22:24

1 Answers1

2

If I understand it correctly - You should be able to achieve this by Deep insert.

Part 3 of my answer in this SO thread talks about reading the returned id & using in next api call. It may help your atomic record creation scenarios.