Search This Blog

Thursday, September 8, 2011

Customized Elements in Multiple Layers

Following sample code is used to get the list of customized Table fields,Class objects in different layers.

static void krishh_listCustomizedObjects(Args _args)
{
    UtilElements    utilElements;
    Dialog          dialog              = new Dialog();
    DialogField     dlgFieldTableName   = dialog.addField(typeid(TableName));
    DialogField     dlgFieldClassName   = dialog.addField(typeid(ClassName));
    Name            tableName,
                    clsName;
    ;
    dialog.caption("List of Customized Objects");
    if (dialog.run())
    {
        tableName =  dlgFieldTableName.value();
        clsName   =  dlgFieldClassName.value();
        while select name, utilLevel
            from utilElements
            order by parentId, recordType
            where (utilElements.parentId    == tablename2Id(tableName)              ||
                   utilElements.parentId    == className2Id(clsName))               &&
                  (utilElements.recordType  == UtilElementType::TableField          ||
                   utilElements.recordType  == UtilElementType::TableFieldGroup     ||
                   utilElements.recordType  == utilelementType::TableInstanceMethod ||
                   utilElements.recordType  == UtilElementType::TableIndex          ||
                   utilElements.recordType  == UtilElementType::TableStaticMethod   ||
                   utilElements.recordType  == UtilElementType::TableRelation       ||
                   utilElements.recordType  == UtilElementType::ClassInstanceMethod ||
                   utilElements.recordType  == UtilElementType::ClassStaticMethod)  &&
                  (utilElements.utilLevel   == UtilEntryLevel::var                  ||
                   utilElements.utilLevel   == UtilEntryLevel::cus ||  utilElements.utilLevel   == UtilEntryLevel::usr)
        {
            switch(utilElements.recordType)
            {
                case UtilElementType::TableField :
                    info(strFmt("Field ID : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableFieldGroup :
                    info(strFmt("Field Group Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableInstanceMethod :
                    info(strFmt("Table Method name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableIndex :
                    info(strFmt("Index name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableStaticMethod :
                    info(strFmt("Table Static method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableRelation :
                    info(strFmt("Relation name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::ClassInstanceMethod :
                    info(strFmt("Class method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::ClassStaticMethod :
                    info(strFmt("Class Static method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
            }
        }
    }
}

Tuesday, September 6, 2011

Search Fields list based on EDT

The following code used to get the list of fields used EDT.
when you run this code you will prompt dialog with text box to enter the EDT Name. Provide EDT Name in the Text box and click on ok.Then you will get the info box with all the list of fields used in different tables.

static void krishh_FindFieldsByEDT(Args _args)
{
    Dictionary dictionary = new Dictionary();
    DictTable dictTable;
    DictField dictField;
    DictType dictType;
    Dialog                  dialog              = new Dialog('Search Fields based on EDT');
    DialogField             dialogEDTName     = dialog.addField(typeid(Name),'EDT Name');
    Int cntDict;
    Int cntFlds;
    Str EDTName;
    ;
    if (dialog.run())
    {
        EDTName = dialogEDTName.value();
    }
    dialog.close();
    if(EDTName=="")
     return;
    /* looping through tables */
    for (cntDict=1; cntDict<=dictionary.tableCnt();cntDict++)
    {
        dictTable = new DictTable(dictionary.tableCnt2Id(cntDict));
       /* looping through fields */
        for (cntFlds=1; cntFlds<=dictTable.fieldCnt();cntFlds++)
        {
            dictField = new DictField(dictTable.id(),dictTable.fieldCnt2Id(cntFlds));
            dictType = new DictType(dictField.typeId());
            if (dictField.type()==Types::UserType && dictType.name()like EDTName)
            {
                info('================================');
                info('Table Name:      ' + dictTable.name  ());
                info('Field Name:  ' + dictField.name());
                info('Base Type:   ' + Enum2Str(dictField.baseType()));
                info('EDT Type Name: ' + dictType.name());
            }
        }
    }
}

Thursday, August 25, 2011

Wednesday, August 24, 2011

Dynamics AX Frameworks

Dynamics AX provides different framworks for each functionality.
Following are the list of AX frameworks

1. Runbase Framework
2. Batch Framework
3. Dialog Framework
4. Operation Progress Framework
5. NumberSequence Framework
6. SysLastValue Framework
7. AIF-Application Integration Framework
8. Wizard Framework
9. Infolog Framework
10.Unit Test Framework

Find Layer Wise changes Objects

UtilElments is the Table where all the object Types and Layer levels will store.
Following job will help you to get the objects in the layer.

static void CusLayerChanges_Find(Args _args)
{
       Utilelements utilElements;
       ;
      while select utilElements where utilElements.recordType 

                             ==UtilElementType::Table &&
                             utilElements.utilLevel == utilentryLevel::Cus
      {
           info(utilElements.name);
      }
}

When AX Starts Open the Form/report

When ever the AX Starts internally AX Kernel will creates an instance of the Info class
Info Class contains one method as startupPost().
This method used to execute the code every time AX starts.

Following Sample used to open the Item Details form whenever AX Starts

void startupPost()
{
    SysSetupFormRun formRun;
    Args args = new Args();
    ;

   args.name(formstr(InventTable));
   formRun = classfactory::formRunClassOnClient(args);
   formRun.init();
   formRun.run();
   formRun.detach();
}

AX 2012 VPC And Materials Download

Partner Source Users only can access the following links.
Dynamics AX2012 VPC
VPCLink

Dynamics AX2012 Materials
MaterialsLink




New in Dynamics AX 2012

Dynamics AX 2012 Unleashed Book Released

Microsoft AX 2012 Unleashed released
Following link you can find reference
http://www.amazon.com/Microsoft-Dynamics-AX-2012-Unleashed/dp/0672335484