Compartilhar via


Best Practices for Table Field Properties

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The following table lists best practices for setting field properties.

Property

Rules

Type

Always ship a table field with the same base type as it has been shipped with before. The size of the field must be the same, or greater than it has been before.

Each field must be defined using a type, or you will get an error. Error icon

 Name

A field should have the same name as the extended data type used, or it should have a logical name.

The field making up the key should be post-fixed "Id," for example, "ItemId."

You can remove the prefix if the name makes sense. For example CustTable.CustName could be CustTable.Name. But do not remove the prefix for ID fields (CustTable.CustId).

If you try to create a field with a name that has already been used in the previous version of Microsoft Dynamics AX, you will get an error. Error icon

A field cannot have the same name as an edit or display method on the same table. Error icon

 Label

Mandatory property.Error icon

It is preferable to put labels on extended data types. If you choose to overwrite the value inherited from the extended data type, the value must be different from the one for the extended data type. Error icon

Do not set the Label property to the same property as the HelpText property. Error icon

The label must be unique for the table. Error icon

The label text cannot end with a period. Error icon

 HelpText

Mandatory property. Error icon

It is preferable to put HelpText on the field’s extended data type. If you choose to overwrite the value, the value must be different than the one for the extended data type or enumeration. Error icon

HelpText must be a complete sentence and have ending punctuation ( ".", "?" or "!"). Error icon

Do not set the HelpText property to the same property as the Label property; Error icon the user should be provided with more detailed information than is available in the label. For more information, see HelpText Guidelines.

GroupPrompt

It is a best practice to leave this property blank. You can use this property to ensure that a field label does not repeat text that appears in a field group label. For example, if a field group on a form is labeled Customer, do not include this text in the GroupPrompt property for fields that are included in the group.

If you do use this property, you must use a label. Error icon

SaveContents

Because virtual fields are rarely used, this property should usually be set to Yes.

Instead of virtual fields, you can use display and edit methods.

 Mandatory

If the field is the primary key (or part of the key), the property must be set to Yes. Error icon

You should set Mandatory = No for enum fields.

The following case is an exception:

If the enum first outcome (value = zero) is named None and has the label Not selected.Warning icon

If you set it to Yes on an enum field, remember that zero is not a valid value.

AllowEditOnCreate

Determines if you can edit the field on a new record. Use AllowEdit to indicate if you can edit the field on an existing record.

Usually set to Yes. When set to yes, the field will be editable when the record is first created.

Set to No when the field will be set programmatically for new records.

If AllowEdit is set to No, and AllowEditOnCreate is set to Yes, you can edit the field on a new record, but not on saved records.

 AllowEdit

Determines if you can edit the field on a existing record. If the field is the primary key (or part of the key), the property must be set to No. Error icon

Visible

Usually set to Yes, but it can be set to No for system-only information (information that will not be shown on the user interface), making the field accessible only from the code.

 ConfigurationKey

This property must have a value to disable the field. It is better to put a Configuration key on the fields extended data type or enumeration.

If you decide to overwrite the value, the value that you give here must differ from the one for the extended data type or enum. Error icon

Disabling a table’s configuration key will also disable the fields in the table.

AliasFor

If the user might think of other fields as keys for the table, in addition to the one that you have designated as the key, set them as alias fields. For example, on the item table, the bar code is an alias for the item ID.

 AnalysisDefaultTotal

Mandatory property if the AnalysisDefaultTotal property has been set for the table, unless the field property Visible has been set to No. Error icon

Set to DefaultField for fields that provide the most important information about a table.

Set to High for fields that are often used for reporting.

Set to Low for fields that are unlikely to be used for reporting.

Set to None for fields that should not be shown for end-user reporting.

Try to limit the number of fields that are set to DefaultField or High to no more than 15.

If you have set AnalysisVisibility to DefaultField or High, the field must be included in at least one perspective. Warning icon

ExtendedDataType

Mandatory property. Error icon

All fields must be defined by using an extended data type or an enum.

Fields that contain the same information must share the same extended data type or enumeration.

 Other properties

Other properties for fields depend on the data type.

For integers and reals, it is a best practice to set FieldUpdate to Absolute.

For strings, StringSize and Adjustment should be set on the extended data type.

For reals, the CurrencyCode property must be set if the following two conditions exist:

  • The data type extends the money system type

  • The AnalysisVisibility property has been set Error icon (for other reals, the property is unavailable)

If the data type is derived from AmountMSTSecondary, you must set the CurrencyCode property to SecondaryCurrency. Otherwise, set it to CurrencyCodeField. If CurrencyCode is set to CurrencyCodeField, you must also set the CurrencyCodeTable property to one of the following:

  • The table containing that field

  • A table for which a relationship exists from the table containing this field, and in which a unique index exists for the fields on the target end of the relationship

If CurrencyCode is set to CurrencyCodeField, you must also set the CurrencyCodeField property to a field by using an extended data type derived from CurrencyCode, in the CurrencyCodeTable.

Note

Do not use master currency amounts to set the CurrencyCode properties, because master currency amounts are always in the master currency for the associated company.

For reals, the CurrencyDate property must be set if the data type extends the money or moneyMST system types. For other reals, the property is not available. Warning icon This property must be set to CurrentRate or CurrencyDateField if the AnalysisVisibility property for the field is set to DefaultField, High, or Low. If the CurrencyDate property is set to CurrencyDateField:

  • The CurrencyDateTable property must be set to one of the following:

    • The table that contains that field

    • A related table in which a unique index exists for the fields on the target end of the relationshipError icon

  • The CurrencyDateField property must be set to a field by using an extended data type derived from Date. Error icon

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.