Dataverse (common data service) - create tables with a script?

2.2k Views Asked by At

Is it possible to create some kind of script (SQL, PowerQuery or whatever) to create tables (and other DB Stuff) in Dataverse? Everywhere I look they only describe how to click click click, I'd like to have a workflow of creating stuff on my own environment and then deploying it somehow on a client (a normal workflow).

3

There are 3 best solutions below

1
RandomRouter On
1
Brent On

To deploy your work into other environments you should use a Solution.

This allows you to package up the configuration and code within a single file for deployment into other instances.

https://learn.microsoft.com/en-us/powerapps/maker/data-platform/solutions-overview

0
Anudeep_Akula On

Each Table is nothing but an Entity in your Dataverse , so Create a new Entity in your dataverse through code:

  1. You need to create an OrganizationServiceContext that implements the IOrganizationService Interface to track and make changes to the Entities in your Dataverse Environment.
  2. Then you need to Create an EntityMetaData class Instance with your Entity Details and pass this to CreateEntityRequest which again has to be passed to the Execute Method of the OrganizationServiceContext. 3)https://learn.microsoft.com/en-us/powerapps/developer/data-platform/org-service/create-custom-entity This might help you