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.

37 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 just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously in their life, he/she can earn his living by doing blogging.thank you for thizs article. best devops online training

    ReplyDelete
  8. Very useful and informative blog. Thank you so much for these kinds of informative blogs.
    We are also a graphic services in gurgaon and we provide the website design services,
    web design services, web designing services, logo design services.
    please visit our website to see more info about this.
    Freelance Graphic Designing
    Freelance Catalogue Designing in delhi
    Freelance Catalogue Designing in gurgaon
    Freelance Brochure Designing
    Freelance Label Designing
    Freelance Banner Designer
    Freelance Poster Designer
    graphic design services in delhi
    graphic design services in gurgaon
    Freelance Catalogue Designing in delhi
    Freelance Catalogue Designing in gurgaon
    Freelance Brochure Designing
    Freelance Label Designing
    Freelance Banner Designer
    Freelance Poster Designer
    graphic design services in delhi
    graphic design services in gurgaon
    Freelance Catalogue Designing in delhi
    Freelance Catalogue Designing in gurgaon
    Freelance Brochure Designing
    Freelance Label Designing
    Freelance Banner Designer
    Freelance Poster Designer
    graphic design services in delhi
    graphic design services in gurgaon
    Freelance Catalogue Designing in delhi
    Freelance Catalogue Designing in gurgaon
    Freelance Brochure Designing
    Freelance Label Designing
    Freelance Banner Designer
    Freelance Poster Designer
    graphic design services in delhi
    graphic design services in gurgaon
    graphic designer in gurgaon
    freelance graphic designer in gurgaon
    freelance graphic designer in gurgaon
    freelance graphic designer in gurgaon
    freelance logo designer in gurgaon
    freelance logo designer in gurgaon
    freelance web designer in gurgaon

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

    ReplyDelete
  10. 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
  11. Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link.
    Best astrology app
    Astro guru tips
    Astro guru tips
    Free horoscope
    Best astrology app for android
    Hindi astrology app
    Best kundli app
    Astrology app in hindi
    Kundli app

    ReplyDelete
  12. 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
  13. 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
  14. Mindblowing, This is an amazing superb article Keep Sharing this...
    Thanks a lot!!!!

    Germany VPS Hosting

    ReplyDelete
  15. 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
  16. 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
  17. 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