Sunday, April 8, 2018

D365 Web API Batch Request, Transaction Integrity, and Logic Apps – Part 2

In my last blog, we looked at achieving transaction integrity using changesets with the batch request. The only problem with the batch request is that you can’t use the record created in initial requests in the subsequent requests. E.g., to create an order, we create an order record first then create all the line items related to the order. In a batch request, you can create the order record but can’t link that record to the order line items.

There are a few options to overcome this issue. This blog is discussing two of those options.For this blog, I am using the logic app created in the last blog (http://mscrmshop.blogspot.com.au/2018/03/d365-web-api-batch-request-transaction.html). This blog creates a contact record with two address records.

Option 1(Create the Contact record GUID Manually)

The one option is to generate a GUID before invoking the batch request and use this GUID  to create the contact record and related address records.

The following screenshots depict the changes in the logic app.
  • The first screenshot displays all the steps for the logic app.
  • The second screenshot displays the step to generate a new GUID for the contact. This step is using Initialize Variable action.
  • The third screenshot shows the part of the batch request. The screenshot also highlights where the GUID is used to create a new contact and related address records.
2018-04-05_15-42-38
2018-04-05_15-47-32
2018-04-05_15-48-32

Note:

The creation of a manual GUID is not recommended for performance reasons. If the number of users and transaction volume can handle the performance hit, only then use this option. Otherwise, consider the second option.

Option 2 (Deep Insert)

The second option is not to use the batch request. The transaction integrity can be achieved using the deep insert.

This option allows us to create a new record and its related records in one operation. If the creation of any of the records fails, the system fails the whole operation.

The following screenshot displays the deep insert web API call.

2018-04-05_16-09-22

Update Considerations

The above two options are useful for creating new records. If you want to update multiple child records based on a parent record, then consider making two API calls:
  • The first call to retrieve the GUID of the parent record based on available attribute/attributes (e.g., first name, last name, email, and address)
  • The second call (batch request)  to update the child records based on the GUID retrieved in the first call.

Download Links

You can download the logic apps created for this blog from the following links:


That is it. If you have a better solution, please share it.

58 comments:

  1. Thanks for posting the information I liked it
    Sanjary Kids is one of the best play school and preschool in Hyderabad,India. Give your child the best preschool experience by choosing the best playschool of Hyderabad in Abids. we provide programs like Play group,Nursery,Junior KG,Senior KG,and provides Teacher Training Program.
    ­play school in hyderabad

    ReplyDelete
  2. If you don't want to create the Guid, or can't do a deep insert for some reason (like during associate requests), you can use the "Alternate Key" feature in Dynamics 365, (https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/define-alternate-keys-entity) and use them instead of the Guid.

    ReplyDelete
  3. Excellent blog information I loved it

    Sanjary Academy is the best Piping Design institute in Hyderabad, Telangana. It is the best Piping design Course in India and we have offer professional Engineering Courses like Piping design Course, QA/QC Course, document controller course, Pressure Vessel Design Course, Welding Inspector Course, Quality Management Course and Safety Officer Course.
    Piping Design Course
    Piping Design Course in Hyderabad ­
    Piping Design Course in India­

    ReplyDelete
  4. Great blog explained clearly about the topic

    Sanjary Academy provide pressure vessel design, quality management system course piping design course, qa/qc course and document controller course.
    Welding Inspector Course
    Safety officer course
    Quality Management Course
    Quality Management Course in India

    ReplyDelete
  5. great Article
    Yaaron Studios is one of the rapidly growing editing studios in Hyderabad. We are the best Video Editing services in Hyderabad. We provides best graphic works like logo reveals, corporate presentation Etc. And also we gives the best Outdoor/Indoor shoots and Ad Making services.
    Best video editing services in Hyderabad,ameerpet
    Best Graphic Designing services in Hyderabad,ameerpet­
    Best Ad Making services in Hyderabad,ameerpet­

    ReplyDelete

  6. Nice blog..! I really loved reading through this article. Thanks for sharing such a amazing post with us and keep blogging...
    Real Estate CRM

    ReplyDelete
  7. Nice post. It is really interesting. Thanks for sharing the post!
    Buy AC Online | Smart LED TV
    Laptops for Sale | Best Inverter AC

    ReplyDelete
  8. I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this azure training , I feel happy about it and I love learning more about this topic.

    ReplyDelete
  9. Get valuable information about the web hosting service and top technical support. I got great information for the VPS Server Hosting.
    Germany VPS Server Hosting

    ReplyDelete
  10. Wonderful system security and database restoring solutions!!!!! that is supper technical helps blog posting. I like this article too much. Thanks for sharing!!!!
    Linux VPS Server Hosting

    ReplyDelete
  11. Mindblowing, This is an amazing superb article Keep Sharing this...
    Thanks a lot!!!!

    Germany VPS Hosting

    ReplyDelete
  12. Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”
    python training in bangalore

    python training in hyderabad

    python online training

    python training

    python flask training

    python flask online training

    python training in coimbatore


    ReplyDelete
  13. Thanks for provide great informatics and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you
    DevOps Training in Chennai

    DevOps Online Training in Chennai

    DevOps Training in Bangalore

    DevOps Training in Hyderabad

    DevOps Training in Coimbatore

    DevOps Training

    DevOps Online Training

    ReplyDelete
  14. Astogurutips is the top best Online Astrology website in India with more than 500+ astrologer on the portal. He gives a Best Astrology solutions from the Best Astrologers . You can connect with our astrologer through call or chat and ask you any question about your carrier, health, future, love partner etc. Free astrology service on phone

    ReplyDelete
  15. I read this article. I think You put a lot of effort to create this article. I appreciate your work. Gaming Jackets

    ReplyDelete
  16. The great website and information shared are also very appreciable.
    rocketeer jacket

    ReplyDelete
  17. Are you in need of a Loan/Funding for a project? Have you been trying to obtain a Loan from any of the Banks or Loan Companies and got Ripped off and they have refused to grant you the Loan because of bad credit? we offer all types of non-recourse Loan and funding at a low Interest Rate of 3% both long term and short term.

    The categories of Loan/financial funding offered include but not limited to: Business Loan, Personal Loan, Company Loan, Mortgage Loan, debt consolidation and financial funding for both turnkey and mega projects E.T.C. from a minimum of Euro / US$1Million to Euro / US$5Billion Max.

    Kindly get in touch for further details and procedure markthomasfinanceltd@gmail.com
    Whats-App no +919667837169
    Dr. Mark Thomas
    Regards

    ReplyDelete
  18. Pretty good post. I have really enjoyed reading your blog posts.Any way Here I am Specialist in Manufacturing of Movies, Gaming, Casual, Faux Leather Jackets, Coats And Vests See Akatsuki Jacket

    ReplyDelete
  19. I really appreciate this post and I like this very much. I am waiting for new post here and Please keep it up in future.

    CloudBox99 offers you with the best Cloud server hosting service in Hyderabad and facilitates enterprises to transform digitally. We keep you covered in terms of all your IT requirements with unmatched expertise and deep domain knowledge

    ReplyDelete
  20. This site helps to clear your all query. mgsu bsc 3rd year result 2021
    Hpu ba 3rd Year Result 2021 This is really worth reading. nice informative article.

    ReplyDelete
  21. Türkiye'nin en iyi torrent oyun indirme sitesine davetlisiniz.
    full oyun indir

    ReplyDelete
  22. very nice post, i definitely enjoy this fabulous website, web design

    ReplyDelete
  23. Great blog, Thanks for sharing this information. Our Astrologer Pandit Yoginath is one of theFamous Astrologer in Bangalore and provides the best astrology services, for more info visit our official website. Horoscope Reading in Bangalore | Black Magic Expert in Karnataka | Get Love Back in India

    ReplyDelete
  24. Hi there I am so delighted I found your weblog, I really found you by accident,
    while I was researching on Bing for something else, Regardless I am here now and would just like to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design), LEARN MORE I don't have time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the excellent job.

    ReplyDelete
  25. Great piece of information.Thanks for sharing it!Get the best business loan funding you need in as little as 24 hours so you can get back to running your business. Contact Funding Center now to take our expert’s advice to choose the best option.

    ReplyDelete
  26. Hi there I am so delighted I found your weblog, I really found you by accident,
    while I was researching on Bing for something else, Regardless I am here now and would just QUALITY UNDETECTED ORIGINAL FAKE DRIVING LICENCE like to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the excellent job.

    ReplyDelete
  27. I must say that you are my favourite author. You always bring surprised things for me everytime I see your articles. Great efforts!! Drive Scorpion Jacket

    ReplyDelete
  28. I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.
    Oracle Fusion HCM Training
    Workday Training
    Okta Training
    Palo Alto Training
    Adobe Analytics Training

    ReplyDelete
  29. That is nice article from you , this is informative stuff . Hope more articles from you . I also want to share some information about micro nutrient for plant growth

    ReplyDelete
  30. İnstagram takipçi satın al! İnstagram takipçi sitesi ile takipçi satın al sende sosyal medyada fenomen olmaya bir adım at. Sende hemen instagram takipçi satın almak istiyorsan tıkla:

    1- takipçi satın al

    2- takipçi satın al

    3- takipçi satın al

    ReplyDelete
  31. I am very impressed to read this blog. I hope you will continue to upload similar blogs. Thank you very much. I have an online store with the name FLYING LEATHER JACKET please visit for an awesome collection.
    MEN AVIATOR LEATHER JACKETS
    B3 BOMBER JACKETS
    MOTOGP LEATHER SUIT
    MOTOGP LEATHER JACKETS

    ReplyDelete
  32. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome!

    B.C.A. Time Table 2022 - BCA 1st 2nd 3rd Ka Exam Routine
    Cusat University Time Table 2022
    Datta Meghe University Time Table 2022
    JRRSU Exam Time Table 2022

    ReplyDelete
  33. wordpress web design company in united states Need professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today!

    ReplyDelete
  34. hotspot shield cracked for pc provides its users with better security for private data, online shopping, and internet privacy. Hotspot Shield License Key

    ReplyDelete
  35. I must say that your article is out standing.most of the articles I come across these days do not really provide valid details that attracts others as yours, but believe me the way you interact is literally awesome  I do respect that so much. I will instantly get your rss and stay informed of any updates you make and as well take the advantage to share some vital information about. IMPORTANCE OF DRY SEAHORSE to human health and how to et them

    ReplyDelete
  36. Get the complete information about Philippines Import Export trade Data by Philippines Eximp for USA, Russia, United Kingdom, France and more countries.
    Philippines Import Data

    ReplyDelete