Tuesday 24 February 2015

How to open web site pages on AX Forms

Today I will demonstrate you that how you can show any webpage on your AX Forms.

1. Create New Form.
2. Right click the Design node of form and add ActiveX control.
3. Select Microsoft Web Browser from AciveX control window list.
4. Go to method node of form and override Init method of form.
5. Add below line of code
           
    ActiveX.Navigate("www.google.com");

Note: - ActiveX is the name of control which we have added in the form previously.


6. Now run your form and check the output

Saturday 21 February 2015

Finding the mandatory fields on table by using X++ code.


The below code is used to get the mandatory fields on table using X++.


static void CheckMandatoryFieldsOnTable(Args _args)
{
    DictTable   dictTable;
    DictField    dictField;
    int               i;
   //Pass the table name
    TableId       tableId = tablenum(SalesTable);
    ;

    dictTable = new DictTable(tableId);
    for (i=1 ; i<=dictTable.fieldCnt() ; i++)
    {
        dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));

        if (dictField.mandatory())
        {
            info(dictField.name());
        }

    }
}


output :