Search This Blog

Thursday, September 8, 2011

Get Parent Relation between Tables using X++

static void krishh_ParentRelation(Args _args)
{
    TableId         tableId = tablenum(SalesTable);
    TableId         extTableId;
    FieldId         fieldId = fieldnum(SalesTable, CustAccount);
    DictField       dictField;
    DictType        dictType;
    DictRelation    dictRelation;
    ;
    dictField       = new DictField(tableId, fieldId);
    dictRelation    = dictField.relationObject();
    extTableId = dictRelation.externTable();
    if (extTableId)
        info(tableid2name(extTableId));
}

2 comments:

  1. Hi, does this work for extended data types ecorescolor, config and size as well? I can't seem to get it to work? Thanks in advance!!

    ReplyDelete
    Replies
    1. Hi this post was for AX2009, I didnt tried in AX2012, because in AX2012 all relations functionality was changed, So i dont think it will work for ax2012 most of the relations.

      Regards,
      krishna.

      Delete

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.