Skip to main content

Posts

Showing posts with the label Create fields Method dynamically in axapta

Create fields Method dynamically in MSD axapta

If you want to create new method at runtime in axapta then you can try following code. To test method you can paste following code in job. TreeNode TreeNode1,tnCust, TreeNdmethod; MemberFunction memberFn; str source; ; TreeNode1 = infolog.findNode(“\Forms\CustTable\Data Sources\CustTable\Fields\Name”); tnCust = infolog.findNode( “\Forms\CustTable“ ); TreeNdmethod = TreeNode1.AOTfindChild( ‘Methods’ ); TreeNdmethod.AOTadd(‘lookup’); memberFn = TreeNdmethod.AOTfindChild( ‘lookup’ ); source = @”public void lookup(FormControl _formControl, str _filterStr) { super(_formControl, _filterStr); }” ; memberFn.AOTsetSource(source, false); memberFn.AOTsave(); TreeNdmethod.AOTsave(); tnCust.AOTcompile();