Let’s see a real life example in dynamics which shows how we can do this.
- Open “ProjInvoiceProposal” form in AOT and then you will see a button as “Create invoice” in the right side.
- Actually this MenuItemButton is calling “ProjInvoiceChoose” class.
- Let’s go to class node and search “ProjInvoiceChoose” class, once you get the class just right click and select edit option this will open all its methods.
- Go to “Main” method of the class and you will see some code similar to given below.
if (args && args.caller())
{
projInvoiceProjId = args.caller().projInvoiceProjId();
projId = args.caller().projId();
}
if (args.caller() && args.caller().callerDataRecord())
{
argsTrans.record(args.caller().callerDataRecord());
transIdList = ProjInvoiceChoose::createTransIdList(argsTrans);
}
- Here you can see the statement like “args.caller().projInvoiceProjId();” In this args.caller() refer to the calling object that is “ProjInvoiceProposal” form in this case and "projInvoiceProjId()" is a method which is created in caller form and called in “ProjInvoiceChoose” class.
- Similarly two more methods called by args.caller() that is “projId()” and “callerDataRecord()”.
Summery: So this is how we can easily call methods from calling object and use it as per our requirement.
No comments:
Post a Comment