Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

shelterbox/JSON2Dataverse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

This repository is no longer actively maintained.

We appreciate all the contributions and support from the community over the years. For those interested in continuing the development, feel free to fork the repository.

If you have any questions or need assistance, please refer to the existing documentation and issues. Thank you for your understanding.

JSON2Dataverse

Quickly create entities, attributes, keys and relationships in Dataverse from a JSON.

Setup

Before you can run the script, you will need to setup the connection between it and your Dataverse instance:

  1. Create ./JSON2Dataverse/app.config file
  2. Add connectionString with the name dynamics to the file. Or copy the example one below to get started

Example app.config

Note

Replace:

YOUR_ENVIRONMENT_URL with your Dataverse enironment URL and,

YOUR_AZURE_APPID with the Microsoft Entra SSO App ID

<?xml version='1.0' encoding='utf-8'?>
<configuration>
  <connectionStrings>
    <add name="dynamics"
     providerName="Microsoft.Xrm.Sdk.Client"
     connectionString="AuthType = OAuth;
     Url = YOUR_ENVIRONMENT_URL;
     AppId = YOUR_AZURE_APPID;
     RedirectUri = http://localhost:64636;
     LoginPrompt = Auto;
     RequireNewInstance = True" />
  </connectionStrings>
</configuration>

Configuring .JSON file

The JSON file is used as a instructionset for the script.

Structure

[
  {
    "Name": "ENTITY_NAME",
    // Optional
    // Can be ATTRIBUTE_DATATYPE: "string", "int", "datetime"
    "PrimaryKey": "ATTRIBUTE_NAME",   
    "Members": {
      // First member is primary attribute
      // Can be ATTRIBUTE_DATATYPE: "string"
      "ATTRIBUTE_NAME": "ATTRIBUTE_DATATYPE",
      "ATTRIBUTE_NAME": "ATTRIBUTE_DATATYPE"
    },
    // Optional
    "ManyToOne": {
      "RELATIONSHIPNAME": "ENTITY_NAME_RELATING_TO"
    },
    // Optional
    "ManyToMany": {
      "RELATIONSHIPNAME": "ENTITY_NAME_RELATING_TO"
    }
  }
]

Data types

ATTRIBUTE_DATATYPE Dataverse type
enum Single line text
string Single line text
boolean Yes/No
datetime Date and time
integer Whole number
long Whole number (Big)
decimal Decimal
binary File

Usage

Once you have the script setup and the JSON file created, you can run the script to build the Dataverse entities. This will first create the entities, attributes and keys; then create the relationships (Many-to-one and then Many-to-many).

About

Quickly create entities, attributes, keys and relationships in Dataverse from a JSON.

Resources

Stars

Watchers

Forks

Languages