Invoke-NAVSanitizeField

Invokes the sanitize field operation on the specified tenant.

Syntax

Invoke-NAVSanitizeField
      [-RemoveDuplicates]
      [-ServerInstance] <String>
      [-Tenant <TenantId>]
      [-CompanyName <String>]
      [[-TableId] <Int32>]
      [[-FieldId] <Int32>]
      [-RetryMode <RetryMode>]
      [-NetworkTimeout <TimeSpan>]
      [-MaxRetries <Int32>]
      [-DelayBetweenRetries <TimeSpan>]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

This cmdlet deletes all the unsupported characters from fields of type "Code" in the tenant database. It trims leading and trailing Unicode white-space characters from a field. These characters are invisible characters, and represent a keystroke like Enter, TAB or space bar. The cmdlet is similar to the System.Trim method. For a list of the Unicode characters, see IsWhiteSpace method.

The cmdlet returns an object containing the number of rows and values modified, the tables impacted and a list of potentially ignored records.

You must specify a Business Central Server instance and a tenant.

Examples

EXAMPLE 1

$result = Invoke-NAVSanitizeField -ServerInstance BusinessCentral -Tenant t1

This example invokes the operation "SanitizeCodeField" on the tenant t1. $result is an object containing the results of the operation execution.

Parameters

-CompanyName

Specifies the name of the company that you want to run the operation on. If you do not set this parameter, the operation will run on all companies.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DelayBetweenRetries

Specifies the delay between retries.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FieldId

Specifies the ID of the field that you want to invoke the operation on. If you do not set this parameter, the operaiton will run on all fields of the table.

Type:Int32
Position:0
Default value:0
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

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

-MaxRetries

Specifies the maximum number of retries for the operation in case of failure.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NetworkTimeout

Specifies the network timeout of the operation.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProgressAction

A common PowerShell parameter that determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider. Learn more.

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveDuplicates

Specifies to delete a record, after it's been sanitized, if it conflicts with an existing record.

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

-RetryMode

Specifies the retry mode when the service instance is not available.

Possible values: Fixed, Exponential

Type:RetryMode
Accepted values:Fixed, Exponential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServerInstance

Specifies the name of a Business Central Server instance, for example, BusinessCentral or myinstance. You can specify either the full name of an instance, such as BusinessCentralServer$myinstance or the short name, such as myinstance.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TableId

Specifies the ID of the table that you want to invoke the operation on. If you do not set this parameter, the operation will run on all tables.

Type:Int32
Position:0
Default value:0
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Tenant

Specifies the ID of the tenant, such as Tenant1.

This parameter is required unless the specified service instance is not configured to run multiple tenants. In which case, you can omit the parameter or set it "default".

Type:TenantId
Aliases:Id
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

By value and property name: ServerInstance

Microsoft.Dynamics.Nav.Types.TenantId

By property name: Tenant

System.String

By property name: CompanyName

System.Int32

By value and property name: TableId

System.Int32

By value and property name: FieldId

Notes

To run this cmdlet, management API services must be enabled on the Business Central server instance. For more information, see Configure Business Central Server.