Adding a “Go to the Main Table Form” link

Go to the Main Table Form is a feature of Dynamics AX, which allows users to jump to the
main record just by right-clicking on the field and selecting the Go to the Main Table Form
option. It is based on table relations and is available for those controls whose data fields have
foreign key relationships with other tables.
Because of the data structure integrity, this feature works most of the time. However, when it
comes to complex table relations, it does not work correctly or does not work at all. Another
example of when this feature does not work automatically is when the form control is not bound
to a table field. In such situations, Go to the Main Table Form has to be implemented manually.
In this recipe, to demonstrate how it works, we will modify the Business relations form in the
CRM module to make sure that the Employee filter at the top of the form allows users to use
the Go to the Main Table Form feature from the context menu.
How to do it…

1. Open the smmBusRelTable form in AOT, and override jumpRef() of the
EmployeeFilter control with:
public void jumpRef()
{
EmplTable emplTable;
Args args;
MenuFunction menuFunction;
;
emplTable = EmplTable::find(this.text());
if (!emplTable)
{
return;
}
args = new Args();
args.caller(element);
args.record(emplTable);
menuFunction = new MenuFunction(
menuitemdisplaystr(EmplTable),
MenuItemType::Display);
menuFunction.run(args);
}
2. To test the result, open CRM | Business Relation Details, make sure an employee
number is specified in the Employee filter, and right-click on the filter control.
Notice that the Go to the Main Table Form option, which will open the Employee
form, is now available:
How it works…
Normally, the Go to the Main Table Form feature is controlled by the relations between
tables. If there are no relations or the form control is not bound to a table field, then this
option is not available. But, we can force this option to appear by overriding the control’s
jumpRef() method.
In this method, we have to add code that opens the relevant form. This can be done by
creating, initializing, and running a FormRun object, but the easier way is to simply run the
relevant menu item. In this recipe, the code in jumpRef() does exactly that.
First, we check if the value in the control is a valid employee number. If yes, then
we run the Display menu item EmplTable with an Args object containing the proper employee
record. The rest is done automatically by the system, that is, the Employee form is opened
with the employee information.
Microsoft Dynamics AX 2009 Development Cookbook.

0 thoughts on “Adding a “Go to the Main Table Form” link

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Dijital Dönüşümünüzü AI İle Hızlandırın

Dynamics 365 ve AI destekli çözümlerle iş süreçlerinizi optimize edin, verinizi anlamlı içgörülere dönüştürün ve büyümenizi sürdürülebilir hale getirin.

AI-Ready Enterprise Partner

Microsoft Dynamics 365 ve yapay zekâ çözümleriyle kurumsal sistemlerinizi güçlendirir, operasyonel karmaşıklığı azaltır ve geleceğe hazır bir mimari tasarlarız.

DMR Göztepe Merkez Ofis

Eğitim Mah. Hızırbey Cad. No:118/5 D:1 Kadıköy İstanbul

Marmara Üniversitesi Göztepe Kampüsü Teknopark

Tel: +90 216 470 79 49

E-posta: info@dmrbt.com

DMR Başıbüyük Ofis

Başıbüyük Mahallesi Süreyyapaşa Başıbüyük Yolu Sk. No: 4/7 Maltepe İstanbul

Marmara Üniversitesi Başıbüyük Kampüsü Teknopark

Tel: +90 216 470 79 49

E-posta: info@dmrbt.com