DictTable.primaryKeyField Method [AX 2012]
Returns the ID of the field that is used for the primary key of the table.
public FieldId primaryKeyField()
Run On
CalledReturn Value
Type: FieldId Extended Data TypeThe ID of the field that is used for the primary key of the table; 0 (zero) if no single field serves as the primary key of the table.
The following example shows the retrieval of the field ID of the primary key for the table.
DictTable dt;
DictField df;
tableId tID;
fieldId fID;
tID = tablenum(CustTable);
dt = new DictTable(tID);
if (dt)
{
fID = dt.primaryKeyField();
if (0 != fID)
{
df = new DictField(tID, fID);
if (df)
{
print strfmt("Primary key field name: %1", df.name());
}
}
}
Community Additions
ADD
Show: