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?

3
  • 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
    Commented Feb 15, 2019 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. Commented Feb 17, 2019 at 5: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?
    – Brendan
    Commented Feb 20, 2019 at 22:24

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.