Bojensen Blogs

How to find All USR Layer Elements in AOT

How to Find all the elements which in present in USR layer

To find all USR layer elements in AOT , you can write job with following code, when you will run this job it will create a new project named “TheAxapta_UsrObject”.

In this Project you find all elements which is present in USR layer by individual grouping. This a good way to find all USR element.

static void FilterBasedOnLayers(Args _args)
{
sysprojectfilterrunbase upgradeproject;
    utilelements            theelements;
    ;

    upgradeproject = new sysprojectfilterrunbase();
    upgradeproject.parmProjectNode(systreenode::createProject(‘theaxapta_UsrObject’));
    upgradeproject.grouping(sysprojectgrouping::AOT);

    while select name, utilLevel, RecordType, ParentId from theelements

    where theelements.utilLevel == UtilEntryLevel::usr
    {
        try
        {
            theelements.reread();
            upgradeproject.doUtilElements(theelements);
        }

        catch (exception::Error)
        {
            throw error(‘error’);
        }
    }

    upgradeproject.write();

    info(‘finish’);
}

Microsoft Dynamics AX Blog *Axapta V/s Me*: How to find All Usr Layer Element in AOT

Comments are closed.