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.

38 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. 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
  8. 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
  9. 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
  10. Mindblowing, This is an amazing superb article Keep Sharing this...
    Thanks a lot!!!!

    Germany VPS Hosting

    ReplyDelete
  11. 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
  12. I read this article. I think You put a lot of effort to create this article. I appreciate your work. Gaming Jackets

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

    ReplyDelete
  14. 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
  15. 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
  16. Türkiye'nin en iyi torrent oyun indirme sitesine davetlisiniz.
    full oyun indir

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

    ReplyDelete
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. hotspot shield cracked for pc provides its users with better security for private data, online shopping, and internet privacy. Hotspot Shield License Key

    ReplyDelete
  24. 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
  25. 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
  26. In addition to information and games, a traditional Indian games website can offer resources such as videos, tutorials, and blogs &Top online Games in India .These resources can help visitors learn the rules and strategies of the games, as well as provide tips for playing and winning.

    ReplyDelete
  27. Amazing Blog. Visit AAR Fragrance for Perfumes for Men Online at Best Prices in India, Buy Perfumes for Women Online in India, Davidoff Cool Water For Men EDT 125ml, and Versace Pour Homme Dylan Blue EDT 100ml.
    Perfumes for Men Online at Best Prices in India

    ReplyDelete
  28. Buy spy gadgets online and discover a world of secret recording, camera detectors, and more. As a trusted wholesaler and store, we provide top-quality products for your ultimate peace of mind. Revolutionize your security with Spy Shop Online today!

    ReplyDelete
  29. Looking to enhance your security surveillance? Buy Spy Gadgets Online at our trusted spy shop. We are the leading dealers in Delhi, India, offering a wide range of top-quality spy gadgets. Protect your loved ones and belongings with our state-of-the-art products. Shop now and experience ultimate peace of mind! Get in touch at +91-9999332099 0r 9999332499.

    ReplyDelete
  30. Visit Orange Pill Clinic for leading Nursing and Doctor Consultation Services at Home, Home Nursing Services in Delhi NCR, and Nursing Services for Suturing Removal at Home. For more information visit our website.
    Home Nursing Services in Delhi NCR

    ReplyDelete