D365 FO/Logic Apps: REST Service For Accepting JSON & Inserting Records Into A Table

LogicApps

Requirement

Third party Vendor wants to push records in D365 Finance and operation by providing input in a JSON format.

JSON Format:

1

Purpose

The purpose of the document is to provide all the necessary steps of developing a REST web service in Logic Apps which will accept JSON message as input. Parse of JSON string will happen in Logic Apps & records will inserted into a table of D365 Finance and operation environment using data entities.

Perquisites

  1. Logic Apps subscription is required
  2. D365 Finance and operation development environment.
  3. Documents related to JSON schema and format should be shared with developer
  4. D365 Data entities should be accessible from outside. In my case I have 2 tables and 2 data entities of both the tables. Tables Name are OrderHeader & OrderLines.23

Steps

  1. Generate the JSON schema by using URL https://jsonschema.net/ using JSON sample4
  2. Create a new Logic Apps from blank template.
  3. Add a trigger of type “REQUEST” – When a HTTP request is received and paste the JSON schema created in step 1 into the section Request Body JSON Schema5
  4. Add a new step and use the new action of type Data Operation – Parse JSON.6
  5. (In case you require) Add a new step for initializing a variable. I am using here Initialize variable action .I am using it for line number counter later.fff
  6. Add a new step by using control – For Each7
  7. Add a new step by using action “Create record”-Dynamics 365 for fin & ops. Provide D365 environment URL , data entity name & credentials. In this example I am using entity OrderHeader.This step should be inside “For Each” loop and we will insert Orderheader data.89
  8. After inserting record into OrderHeader entity , we will fill details by using OrderLine Entity.Flow is mentioned below1011
  9. Save your flow
  10. Copy the HTTP POST URL12
  11. For testing visit website https://apitester.com/13
  12. Records are inserted14

cheers

piyush adhikari 🙂

One thought on “D365 FO/Logic Apps: REST Service For Accepting JSON & Inserting Records Into A Table”

Leave a Reply