Wednesday, August 21, 2024

Package export Api through logicapp

 Scenario:-Exporting  data package from d365fo

I got a requirement where I need to Export d365fo data package of Customersgroup data to OneDrive

Step1:-Create a data export project in d365fo

Step2:-Create logic app and choose Recurrence as trigger point for logicapp. I have set it for one day but will fire manually.

Step3:-Take http connector and use export to package URL

Post:-d365url/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage

In body :-

{ "definitionGroupId":"<Data project name>", "packageName":"<Name to use for downloaded file.>", "executionId":"", "reExecute":true, "legalEntityId":"<Legal entity Id>" }

Step4:-Put delay so that datapacakages need to be exported

Step5:-Use parse json under data operations by and  put previous http output as sample payload

or else paste this code

{ "@odata.context":"https://<baseurl>/data/$metadata#Edm.String", "value":{ "value":"<executionId>" } }

Step6:-Use another http now to get exportedpackageurl

POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl BODY {"executionId":"<Execution Id>"}

Step7:-Use parse json to use this output in next http connector

Step8:-Till now I got exported package URL itself now I need file to send

URL will be previous http Output this is why I taken parse json and no body

Step9:-Now I need to send this file to OneDrive

Step10:-Fire logicapp manually then after few minutes you will be able to see file added in OneDrive

Step11:-Open the file and download

Step12:-Now you can see file downloaded in local desktop

Step13:-Open excel file and see data 

Note:-You can see extra two files like manifesto and Package header files as it is a data package it contains Don't Worry

Keep Daxing!

No comments:

Post a Comment

Upload File from local system in a form

 Actions to be done at 3 stages  1) Create Fileupload item by right clicking on design as shown in image below 2)Change Properties especiall...