Thursday, 18 September 2014

Find mandatory Fied in Table



                                      Find Mandatory Field In Table

In Microsoft Dynamics Ax 2012 many table are having mandatory field. Here I would like to share how to find mandatory field in a Table.

For Example CustTable.


The below code uses DictTable and DictField classes to iterate through the table fields and it's properties.

Using these classes you can also check other properties of the fields in a table.

Step 1:-

 Go to job, Create a New job, paste following code in the job and Run the job.


 Step 2:-

static void mandatory(Args _args)

 {
    DictTable       dictTable;  //SysClass

     DictField       dictField;  //SysClass

     int             i, cust;
 
    dictTable = new DictTable(tableNum(CustTable));

     cust= dictTable.fieldCnt();   // fieldCnt- Returns the number of fields for a table//

     for (i= 1; i<=cust;i++)

     {
        dictField = new DictField(tableNum(CustTable),dictTable.fieldCnt2Id(i));

                                     //fieldCnt2Id-Returns the field ID of the field that is specified by an index//     

         if (dictField.mandatory())

         {

             info (strFmt("Field %1 is mandatory.",dictField.label()));  //Returns the label for the field//
         }
    }
   
}

Step 3:-

You can see the list of mandatory field in Infolog.



   
 

Monday, 15 September 2014

HOW TO OPEN WEB PAGE FROM AX 2012

Step 1:-

                 Create a From OpenWebPage.

Step 2 :-

                 Under the design node select ActiveX control.


                                 



Step3:-

              Once we select ActiveX Control a dialog prompts, select "Microsoft web browser" option.



 Step 4:-

        After place the following code in form level init method.


public void init()
 
{
 
super();
ActiveX.Navigate(www.bing.com);
 
 
}

 
 
Step 5:-
 
            You can see  Bing Web Page Opening in AX 2012.