Wednesday, August 30, 2017

Jumpref in AX 2012

Hi All,
We all know about “View Details” Option in our Ax 2012 Forms and Tables.
Here I wrote one sample for how to get that functionality in our forms or table.
This is done by three ways:
1) By EDT Relations
2) By using JumpRef method
3) By using FormRef property in Table
EDT Relations:
If you use an EDT in tables which have relation with some other table fields, that time you can able to navigate the main table or main form.
FormRef Property:
Select the Table and go to properties and select the required form in the FormRef property.
JumpRef method:
If you are not having that option, simply write an override the JumpRef method in a field of DataSource or in a Form Control. Here I show you a sample jumpRef method code:
public void jumpRef()
{
Args            args;
;
args = new Args();
args = new Args(menuFunction.object());
args.caller(element);
args.record(“RecordName”); // to be a datasource which added in the current form
new MenuFunction(menuitemDisplayStr(“FormName”), MenuItemType::Display).run(args);
}
In the form init() which we called here, we have to check the condition whether the form is called by any dataset or not.
E.g.,
public void jumpRef()
{
Args args = new Args();
SalesTable salesTable;
;
args.caller(this);
salesTable = SalesTable::find(SalesLine.SalesId);
Args.record(salesTable);
new MenuFunction(menuitemdisplaystr(SalesTable), MenuItemType::Display).run(args);
}
Thanks & Happy DaXing….

No comments:

Post a Comment

D365 Extensions: Extend the validateField Method on a Table

In this post I will going to show you, how to extend the validateField method on a table. As example I used the SalesLine, where I will ...