Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Make Create Reiterate / X++ “Cross reference” for e...

X++ “Cross reference” for extended data types

I wrote a job to check which fields uses a specific enum. This week I needed something similar for an extended data type and I modified it to work with EDTs instead.

The cross reference on the environment I am currently working on is not up to date. I used this job to find all the table fields that use this extended data type, similar to what the standard cross reference function does.

Simply change the extended data type in line 5 to the EDT you want to investigate, and the job makes a list of table fields that uses the EDT. You can also change the layer depending on what you are looking for.

For example, for InterCompanyCompanyId, searching through all the fields in the SYS layer:

//Tina van der Vyver
//makecreatereiterate.com
static void edtCrossReference(Args _args)
{
    str                 edtName = extendedTypeStr(InterCompanyCompanyId);
    ExtendedTypeId      edtId = extendedTypeName2Id(edtName);
    UtilIdElements      utilfield;     
    DictField           dictField;       
 
    setPrefix(strFmt("EDT: %1", edtName));
 
    while select parentId, utilLevel, Name, id from utilfield
        where utilfield.recordType == UtilElementType::TableField        
        && utilfield.utilLevel  == UtilEntryLevel::sys
    {
        dictField = new DictField(utilfield.parentId, utilfield.Id);
 
        if (dictField.typeId() == edtId)
        {      
            info(strFmt("%1: %2 - %3", utilfield.utilLevel, tableId2name(utilfield.parentId), dictField.name()));
        }
    }
}

IntercompanyCompanyId crossreferance

Comments

*This post is locked for comments