< Back

Resolve-AxTableFieldIDs

Sat Jan 11, 2020 8:18 am

NAME Resolve-AxTableFieldIDs



SYNOPSIS

Fix table and field ID conflicts





SYNTAX

Resolve-AxTableFieldIDs [-DatabaseServer <String>] [-DatabaseName <String>] [-ModelstoreDatabase <String>]

[-SqlUser <String>] [-SqlPwd <String>] [-Force] [-OutputCommandOnly] [<CommonParameters>]





DESCRIPTION

Fixes both table and field IDs in the AX SqlDictionary (data db) to match the AX code (Model db)



Useful for after a database has been restored and the table or field IDs do not match

Run this command instead of letting the database synchronization process drop and recreate the table



Before running:

Stop the AOS

Always take the appropriate SQL backups before running this script



After running:

Start the AOS

Sync the database within AX



Note:

Objects that are new in AOT will get created in SQL dictionary when synchronization happens





PARAMETERS

-DatabaseServer <String>

Server name of the database server



Default value is: "localhost"



Required? false

Position? named

Default value $Script:ActiveAosDatabaseserver

Accept pipeline input? false

Accept wildcard characters? false



-DatabaseName <String>

Name of the database



Default value is: "MicrosoftDynamicsAx"



Required? false

Position? named

Default value $Script:ActiveAosDatabase

Accept pipeline input? false

Accept wildcard characters? false



-ModelstoreDatabase <String>

Name of the modelstore database



Default value is: "MicrosoftDynamicsAx_model"



Required? false

Position? named

Default value $Script:ActiveAosModelstoredatabase

Accept pipeline input? false

Accept wildcard characters? false



-SqlUser <String>

User name of the SQL Server credential that you want to use when working against the database



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SqlPwd <String>

Password of the SQL Server credential that you want to use when working against the database



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Force [<SwitchParameter>]

Instruct the cmdlet to overwrite any existing bak (backup) tables from previous executions



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-OutputCommandOnly [<SwitchParameter>]

When provided the SQL is returned and not executed



Note: This is useful for troubleshooting or providing the script to a DBA with access to the server



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.String





NOTES





Author: Dag Calafell, III (@dodiggitydag)

Reference: http://calafell.me/the-ultimate-ax-2012 ... on-errors/



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Resolve-AxTableFieldIDs



This will execute the cmdlet with all the default values.

This will work against the SQL server that is on localhost.

The database is expected to be "MicrosoftDynamicsAx_model".











RELATED LINKS