To pass the parameter from the form selected record to class
1.Create a class as following code.
2.Add this class to Actions MenuItem.
3.In form add this MenuItemButton.
Open the form Select a record in the grid and click the button.
That record passed to the Main method. in info you will Vendor id get 2 times.
Cause New Method is calling and Post method is calling.
public class EmplProcess
{
VendTable _VendTable;
}
-
public void new(Common vTable)
{
_VendTable = vTable;
this.post();
}
-
public void post()
{
info(_VendTable.AccountNum);
}
-
public static void main(Args args)
{
Common _common;
EmplProcess _EmplProcess;
_common = args.record(); //getting the record from the form
_EmplProcess = new EmplProcess(_common);//passing the above record to the new method
_EmplProcess.post();// calling the post method
}
__________________________________________________________________________________--
While creating Object for class we can pass the parameter.
ex:
Class1 cls;
;
cls = new Class(VendTable);// this is Data Source name in Vend Table form
//in class override the new method and assign the Parameter.
public void new(VendTable vTable)
{
_VendTable = vTable;
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
Subscribe to:
Post Comments (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...
Where u write Clicked method
ReplyDeletePlease write a post proper way, it is much confusing man.