Export And Import Data Entity for OData


1. Make sure that you opened Visual studio as administrator.

2. Also check that your module is referring to basic models like ApplicationSuite, Application Foundation, etc.

3. Create a new Dynamics 365 project.

4. Create a data entity by right-clicking on your project. Add new item -> Data model -> Data entity

5. Select the table you want for your entity in the Primary Datasource option

6. Select Entity Category either Document or Master.

Click next, now it creates the entity along with the other required stuff.

Build and sync project.

Exposing as Json file:

Below mentioned URL will be used for checking any exposed data entity.  But you need to concatenate the public collection name of your data entity at the end of  the URL

https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/DataentityPublicCollectionName

Note: the link may differ according to your company domain.

 For verification, you may use this URL on IE or chrome and it will generate JSON file. 

 Exporting from Data Management:

Create a new group, add some description. Select Your Entity and the format you want for your data Add and then click the export button. And finally, click on Export Now

Sometimes this downloading stuck or take a lot of time so make sure your service is running or restart it.


Importing from Data Management:

Create a new group, add some descriptions. Select Your Entity and the format in which your data is. Select the file you want to import Upload and Add and then click the import button. And finally, click on Import Now

In case your import or export is unsuccessful view the execution log for the errors and tries to figure out the problem.

In my case the duplication problem occurs as the index fails to make the record unique, so I need to add a new index in the table.

Also, check the stagging table for data. Empty in my case.


After making changes in your table make sure these changes also reflect in the entity for this first Restore the entity and the update the Stagging table. If the changes still not reflecting, then delete the stagging table and regenerate it.

Entities usually not pick the changes immediately so for making sure that your changes are picked up Click on the Data Entity tile.

And select your Entity make sure any group is not using it at that time then Delete it and then sync and rebuild your project.

Click on the framework tile for refreshing the changes

Now re-import the entity. Voila, it worked!!



 

Comments

Popular posts from this blog

Batch jobs stuck on WAITING status in AX 2012

Electronic Reporting For Beginners

Computed column and virtual field in D365