New-NAVCrmTable

Creates Business Central table objects that are based on Dynamics 365 for Sales entities. The table objects are saved as .txt files.

Syntax

New-NAVCrmTable
   [-CRMServer] <Uri>
   [-Credential] <PSCredential>
   [-EntityLogicalName] <String[]>
   [-ObjectId] <Int32[]>
   [-AuthenticationType <CrmAuthentication>]
   [-Name <String[]>]
   [-RedirectUri <String>]
   [-Domain <String>]
   [-HomeRealmUri <String>]
   [-ClientId <String>]
   [-DeltaPath <String>]
   [-OutputPath <String>]
   [-Force]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-NAVCrmTable
   [-EntityLogicalName] <String[]>
   [-ObjectId] <Int32[]>
   [-Name <String[]>]
   [-OutputPath <String>]
   [-Force]
   -ConnectionString <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Use this cmdlet when integrating Business Central with Dynamics 365 for Sales. This cmdlet creates one or more table objects in Business Central that correspond to entities in Dynamics 365 for Sales. The created tables are eventually used to map fields in Dynamics 365 for Sales with fields in business data tables of Business Central. Each table object is saved as a .txt file on your computer or network and can be imported into a Business Central database. The tables have the following characteristics:

  • The TableType property is set to CRM.
  • Contains field definitions for all fields in a Dynamics 365 for Sales entity that have a data type that is supported by Business Central. References to other Dynamics 365 for Sales entities will only be included if the entity is included in the command line.

Only external tables that are based on by actual Dynamics 365 for Sales entities are supported. In Dynamics 365 for Sales, the entities must support one or more of the following actions:

  • Create
  • Update
  • Delete
  • Retrieve
  • RetrieveMultiple
  • Associate (one-to-many relationship only)
  • Disassociate (one-to-many relationship only)
  • Execute (only for setting state)

Examples

EXAMPLE 1

New-NavCrmTable -CRMServer myserver.crm.dynamics.com -Credential (Get-Credential -UserName user@myserver.onmicrosoft.com -Message "Enter Password") -EntityLogicalName account -Name "CRM Account" -ObjectId 50500 -OutputPath c:\CrmObjects
          FileName    : c:\CrmObjects\TAB50500.TXT
          ObjectType  : Table
          Id          : 50500
          VersionList :
          Date        :
          Time        :
          Modified    : False

This example creates a single Business Central table object based on the account entity in Dynamics 365 for Sales. The created table has the ID 50500 and name CRM Account.

EXAMPLE 2

New-NavCrmTable -CRMServer myserver.crm.dynamics.com -Credential (Get-Credential -UserName user@myserver.onmicrosoft.com -Message "Enter Password") -Entity account,contact -Name "CRM Account","CRM Contact" -ObjectId 50500,50501 -OutputPath c:\CrmObjects
          FileName    : C:\CrmObjects\TAB50500.TXT
          ObjectType  : Table
          Id          : 50500
          VersionList :
          Date        :
          Time        :
          Modified    : False
          FileName    : C:\CrmObjects\TAB50501.TXT
          ObjectType  : Table
          Id          : 50501
          VersionList :
          Date        :
          Time        :
          Modified    : False

This example creates two Business Central table objects based on the account and contact entities in Dynamics 365 for Sales.

EXAMPLE 3

New-NavCrmTable -CRMServer https://myserver.local.com/myOrg -Credential (Get-Credential -UserName myserver\UserName -Message "Enter Password")  -AuthenticationType=AD -Entity account,contact -Name "CRM Account","CRM Contact" -ObjectId 50500,50501 -OutputPath c:\CrmObjects

This example creates two Business Central table objects based on the account and contact entities in on-premise Dynamics 365 for Sales installation using an with Azure AD authentication.

EXAMPLE 4

New-NavCrmTable -CRMServer . -Credential (Get-Credential -UserName "." -Password ".") -ConnectionString "Url=http://myserver.net/org;UserName=myServer\MyUser;Password=myPassword;AuthType=AD" -Entity account,conta -Name "CRM Account","CRM Contact" -ObjectId 50500,50501 -OutputPath c:\CrmObjects

This example creates two Business Central table objects based on the account and contact entities in Dynamics 365 for Sales using a user specified custom connection string.

Required Parameters

-CRMServer

Specifies the URl of the Dynamics 365 for Sales server to connect to. The Dynamics 365 for Sales server provides access to the entity that you want to create as a table in Business Central. The URL specifies the URI scheme, such as HTTPS or HTTP, and the fully qualified domain name (FQDN) that identifies the Dynamics 365 for Sales organization and the computer where the Dynamics 365 for Sales server is installed. For connecting to Dynamics 365 for Sales Online, the format is typically scheme://organizationname.domainname, such as https://mycrm.crm4.dynamics.com, where https is the scheme, myorganization is the organization and crm4.dynamics.com is the domain.

Type:Uri
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ConnectionString

Specifies a passthrough connection string that will be used to connect to the Dynamics 365 for Sales instance.

For information about how to create a valid connection string, see Use connection strings in XRM tooling to connect to Dynamics 365.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Credential

Specifies a user name and password for accessing Dynamics 365 for Sales.

Type:PSCredential
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EntityLogicalName

Specifies the logical names of the Dynamics 365 for Sales entities for which to create a Business Central table. This parameter is a comma-separated list. So when you are creating tables for multiple entities, separate each entity logical name with a comma. Each entity logical name must have a corresponding value in the ObjectID parameter based on its position is the list.

Type:String[]
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ObjectId

Specifies the IDs of the table objects to be created. This parameter is a comma-separated list. So when you are creating multiple table objects, separate each ID with a comma. Each ID must have a corresponding value in the EntityLogicalName parameter, and optionally in the Name parameter, based on its position is the list.

Type:Int32[]
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-AuthenticationType

Specifies the authentication type to connect to Dynamics 365 for Sales instance.

  • OAuth is supported for online and on-premises instances.
  • AD and IFD (AD FS enabled) are supported for on-premises instances only.
  • Office365 is permitted for online instances only.

The AuthenticationType parameter is optional. For a list of valid values, see AuthenticationType Enumeration. The default value is Office365, which is the required authentication type for CRM Online.

Possible values: AD, IFD, Office365, OAuth

Type:CrmAuthentication
Parameter Sets:AD, IFD, Office365, OAuth
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ClientId

Specifies the Client ID (or Application ID) that was assigned to the Business Central application when it was registered in Microsoft Azure Active Directory or Active Directory Federation Services (AD FS). This parameter is only applicable when the -AuthenticationType parameter is set to OAuth.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DeltaPath

Specifies the path for the existing NAV CRM objects, to maintain the existing ID's on the current fields. If object with similar ID is found, we will try to field name match the id's. If no match new ID's will be created for the fields.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Domain

Specifies the domain that will verify user credentials.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Specifies that existing files of the same name in the OutputPath folder are to be overwritten. Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-HomeRealmUri

Specifies the Home Realm Uri. This parameter is only applicable when the -AuthenticationType parameter is set to OAuth.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the names of the new tables to be created. This parameter is a comma-separated list. So when creating multiple tables, separate each table name by a comma. Each individual name must have a corresponding item in the ObjectID and the EntityLogicalName parameters, based on its position in the list.

The Name parameter is optional, but if you use it, you must specify the names of all new tables, not just one. If you do not specify names, then the tables get the entity logical names as specified by the EntityLogicalName parameter.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OutputPath

Specifies the folder path to where the generated .txt files for tables will be saved, such as "c:\CRMObjects". If the folder path does not already exist, it will be created.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RedirectUri

Specifies the Redirect URI that was assigned to the Business Central application when it was registered in Microsoft Azure Active Directory or Active Directory Federation Services (AD FS). This parameter is only applicable when the -AuthenticationType parameter is set to OAuth.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False