HI Folks,
Hope this will help you..In the following scenario we have to insert records in CustGroup from the child form.
As shown below. Can be achieve by using FormDataSource or FormObjectSet classes.
Note: formDataSource = element.args().record().dataSource(); // _object = element.args().record().dataSource();
Step 1 create a button in cust goup form
Step 2 In this button write the below code where you are calling a form and passing the record.
void clicked()
{
Args args;
FormRun formRun;
super();
args = new args("CustGroupCreate");
formRun = new FormRun(args);
args.record(CustGroup);
formRun.init();
formRun.run();
formRun.wait();
}
Step 3 Create new form called "CustGroupCreate" as shown below with unbounded controls.
Step 4 Declare a variable for FormDataSource class in as shown below :
public class FormRun extends ObjectRun
{
FormDataSource formDataSource; // FormObjectset _object;
CustGroup localCustGroup;
}
Step 5 Override a init() method and write the below code to get the parent form datasource.
public void init()
{
super();
if(element.args().record())
formDataSource = element.args().record().dataSource(); // _object = element.args().record().dataSource();
}
Step 6 Take another override method close()and code for insertion and using the formDataSource variable refresh the parent Data Source as shown below. Once you you insert a record and close the form that will refresh the parent Data source immediately.
public void close()
{
super();
localCustGroup.CustGroup = CustGroup_CustGroup.text();
localCustGroup.Name = CustGroup_Name.text();
localCustGroup.PaymTermId = CustGroup_PaymTermId.text();
localCustGroup.insert();
formDataSource.research(true); // _object.research(true);
}
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...
thanks for given information we are providing microsoft dynamics online training with real time faculty if any one interest to learn microsoft dynamics ax view here
ReplyDelete