Skip to main content

Posts

Showing posts with the label foms

Argument Passing between Forms in Dynamics Ax 2009

Here a sample code to pass argument to one form to another form and using of Args() class. Steps: 1) Create two Forms named FormA and FormB 2)Use the EmplTable as the Datasource of both forms 3)Design FormA with one Grid and add 4 data fields to the Grid(EmplId,DEL_Name,Grade,EmplStatus…..) 4)Assign the datasource for the grid and the data fields 5)Add a Button in FormA 6)Override the Clicked() method and write the below code: void Clicked() { Args _args; FormRun _formRun; EmplId _empId; ; _empId = EmplTable.EmplId; // Selected employee id in the Grid is assigned to the variable which is pass to the next form _args = new Args(); // creating a object for args class _args.name(formstr(VA_FormB)); // Form Menuitem _args.caller(this); // Form Caller(Current Form is mentioned as this) _args.parm(_empId); // Employee Number is passed to next form[but parm() is not a best practise] _args.record(EmplTable); // Table name is passed _formRun = ClassFactory.formRunClass(_args); //ne...

Passing values between forms

The code of button click event of FormA which calls FormB and passes some parameters to that form. void clicked() { // Args class is usually used in Axapta for passing parameters between forms Args args; FormRun formRun; // Our custom made class for passing complex set of parameters FormBParams formBParams = new FormBParams(); Array items = new Array( Types::String ); int i; ; args = new args(); // Our values which we want to pass to FormB // If we want pass just simple string we can use 'parm' method of 'Args' class args.parm( strValue.text() ); // We also can pass enum value to FormB args.parmEnum( NoYesEnumValue.selection() ); args.parmEnumType( EnumNum( NoYes ) ); // and also can pass a cursor pointing to some record (in our case it is EmplTable ) args.record( EmplTable ); // If we want pass more complex set of parameters we can develop our own class ...