labelaxaptax++dynamics-ax-2012

AX 2012 - How can I retrieve the labelid of a field


I want to get the label of a field in a specific language. This could be done through something like: SysLabel::labelId2String(literalstr('@SYS1'), 'en-us');

But to do so, I need the LabelId of the field, which I don't know how to retrieve.

Can anyone help me on this?


Solution

  • Found the answer:

    Apparently I should initiate a SysDictField object and call the labelLabel method.

        SysDictField df;
    
        df = new SysDictField(common.RefTableId, common.RefFieldId);
    
        info(SysLabel::labelId2String(df.labelLabel(),SystemParameters::getSystemLanguageId()));