Share via


Invoke-NAVSanitizeField

Invokes the sanitize field operation on the specified tenant.

Syntax

Default (Default)

Invoke-NAVSanitizeField
    [-RemoveDuplicates]
    [-ServerInstance] <String>
    [-Tenant <TenantId>]
    [-CompanyName <String>]
    [[-TableId] <Int32>]
    [[-FieldId] <Int32>]
    [-Force]
    [-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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:0
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RemoveDuplicates

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:0
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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".

Parameter properties

Type:TenantId
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

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.