Pages

May 30, 2012

How to find All Usr Layer Element 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');
}

When this job is finished you get a new project in your Share Project node.
-Harry

1 comment:

  1. you can find any Layers Object just replace layer name here
    **theelements.utilLevel == UtilEntryLevel::usr**

    ReplyDelete

Thanks