0% found this document useful (0 votes)
32 views30 pages

Advanced Form Development in D365FO

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views30 pages

Advanced Form Development in D365FO

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Overview of Advanced Form Development

Presented by: VijayKumar C Date: 23 May 2025


Agenda
1. Execute Query
2. Form Patterns
3. Call a Form from Another Form
4. Form Lookups
5. Display Method
6. Edit Method

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 2


Execute Query

What is Execute Query?

In Dynamics 365 Finance & Operations (D365FO), the ExecuteQuery() method is used
to run a query to fetch records dynamically. It helps in retrieving, filtering, and
refreshing data in forms and reports without reloading the entire UI.

Uses of Execute Query

• Dynamically fetch records from a table


• Supports QueryBuildRange to apply dynamic conditions.
• We can filter the specific item or customer to see details

3K TECHNOLOGIES CONFIDENTIAL 3
Details explanation of Execute Query here I created Table and
forms and methods.
TABLE AND PROJECT NAME

In this screenshot, I have created a table and marked my project name on the right side. On the left side, the table
name is displayed

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 4


Form

In this screenshot, I have created a form and customized its design by applying various patterns.
Additionally, I have added a data source, which determines how the data is displayed in the form.
Based on these configurations, the form page displays the design shown below, providing a demo view of
the result.

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 5


Display menu item

In this screenshot, we see the Display Menu Item used for displaying an item on the front end. To achieve this,
we need to set specific properties. Additionally, we must extend the default model.
In this case, I have extended the AccountsReceivable model. In the screenshot below, I have shown how I added
my Display Menu Item to the AccountsReceivable model
05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 6
Front-End view of Execute Query

I executed the query with a filter to display only cars, successfully retrieving and showing only
car-related results

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 7


2. Form Patterns
1. Simple List and Details Form In D365
2. How To Add A Form Splitter In D365

Here I given some explanation and also I attached screenshot what I done on this topics just go through one
by one will understand.

1.1 Simple List and Details Form In D365


 A Simple List and Details form in Dynamics 365 Finance and Operations (D365FO) is a type of form
pattern used to display a list of records along with the detailed information of the selected record in a
structured and user-friendly way.

 • This form pattern is commonly used for master data management, such as customers, vendors,
products, etc.

• It consists of two main sections:


a) List Pane - Displays multiple records in a grid.
b) Details Pane - Displays the details of the selected record.
• The user can click on a record in the list, and its details will appear in the details section.
• It improves usability by allowing users to navigate records efficiently without switching between
different forms.
05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 8
2.1 How To Add A Form Splitter In D365
> A Form Splitter in D365FO is a UI feature that allows users to resize different sections of a form dynamically. It provides
flexibility by letting users adjust the size of panels, improving visibility and user experience.
• When a form has multiple sections (like a list and a details section), a splitter lets users resize them by dragging
a divider.
• This is useful when working with large datasets where users might want to focus more on either the list or
details section.
• The splitter feature is enabled through the AllowSplitter property in the form design.

In this screenshot, I created a form and also designed some parts on the right
side.
05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 9
In this screenshot, I am showing the result of the front-end,
similar to how we will achieve the form patterns.

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 10


[Link] a Form from Another Form

> In Dynamics 365 Finance & Operations, we often


need to pass data from one form to another. This
can be done using:
1. The Args class
2. Menu items
3. Enum parameters
In the screenshot below, I have created a form,
added a data source, and included a methods node.
Additionally, I have structured the form to align with
best practices, ensuring proper data binding and
functionality

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 11


Example code
[Forml
public class TKT VrcVehicleForm extends FormRun

TKT VehicleServiceWorkbenchEnum mode;

/// <summary>
—HI

/// </summary> public void initO _{


_super();

_if( [Link])
_{
_

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 12


//parameter Args
_iffelement.[Link] == 'EnableReadOnly')
_{
_//disable data sources
_TKT VrcVehicle [Link](false);
_TKT VrcVehicle [Link](false);
_TKT VrcVehicle [Link](false):

_//disable buttons in button group

_FormButtonGroup.enabled(false);
_}
_}
}
public void initEnumParameter()
{
if ([Link]())
{

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 13


_//Handle the scenario where the args sends in a
TutorialVehicleServiceWorkbenchMode enum.
_//Use the passed in enum to control whether you can edit the form or not.
_if ([Link] = =
enumNum(TKT VehicleServiceWorkbenchEnum))
{
mode = [Link]:
[Link]:
}
}
}
public void changeFormBasedOnModeO
_{
switch (mode)
_{

_case TKT VehicleServiceWorkbenchEnum::FullOperation:


_TKT VrcVehicle [Link](true);
_TKT VrcVehicle [Link](true);
_TKT VrcVehicle [Link](true):
_FormButtonGroup.enabled(true):
Break;
}

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 14


_//Do not allow editing, deleting, or creation on the datasource in

'Readonly'

mode.

_case TKT VehicleServiceWorkbenchEnum::Readonly:

_TKT VrcVehicle [Link](false);

_TKT VrcVehicle [Link](false);

_TKT VrcVehicle [Link](false);

_FormButtonGroup.enabled(false);

_break;

_}

} 05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 15


[DataSource]
class TKT_VrcVehicle
{
/// <summary>
///
/// </summary>
public void executeQuery()
{
QueryBuildDataSource queryBuildDataSource;

queryBuildDataSource = [Link]().dataSourceTable(tableNum(TKT_VrcVehicle));
[Link]();
[Link](fieldNum(TKT_VrcVehicle,
VehicleType)).value(queryValue([Link]()));

super();
}

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 16


}
[Control("ComboBox")]
class VehicleTypeComboBoxControl
{
/// <summary>
///
/// </summary>
/// <returns></returns>
public int selectionChange()
{
int ret;
ret = super();
TKT_VrcVehicle_ds.executeQuery();
return ret;
} }}

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 17


Here is a screenshot of the UI page where I added the result section. In this page, I
have marked a button that, when clicked, will navigate to the next form. This
demonstrates how we can achieve calling one form from another
05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 18
[Link] Lookups

Lookups in Dynamics 365 Finance & Operations help users select values from predefined

lists. There are multiple ways to create lookups in forms:

• AutoLookup Property (Automatic)

• SysTableLookup Class (Custom)

• Overriding the lookup() Method (Advanced Customization)

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 19


I created a table in Dynamics 365 F&O and established a relationship between fields to enable a
lookup on a form. The relation ensures that a foreign key in my table links to a primary key in another
table, allowing users to select values through a lookup

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 20


In this screenshot, we can see the form lookup in action. This lookup allows users to
select values from a predefined list, making data entry more efficient and user-friendly.

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 21


5. Display Method

 A display method in Dynamics 365 Finance and Operations


(D365FO) is an X++ method used to calculate and return values
that are not stored in the database but need to be shown on a
form or a report. These methods are marked with the display
keyword and are typically used in tables and forms

I have created a new field in the default SalesTable form to display


the calculated result of the physical inventory. To achieve this, I
implemented a display method at the code level. The method
dynamically fetches and displays the calculated value without
storing it in the database

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 22


Below I added screenshot of display method I attached

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 23


I written code for Display Method
[ExtensionOf(tableStr(SalesLine))]
final class TKT_PhysicalInventory_Extension
{ public static display InventQtyAvailPhysical displayPhysicalQty(SalesLine _this)
{ InventQtyAvailPhysical physicalQty;
InventOnhand inventOnhand;
InventDim inventDim;
InventDimParm inventDimParm;
// Fetching InventDim from SalesLine
inventDim = InventDim::find(_this.InventDimId);
[Link](inventDim);
// Using InventOnhand class to get the correct available physical inventory
inventOnhand = InventOnhand::newParameters(_this.ItemId, inventDim, inventDimParm);
physicalQty = [Link]();
return physicalQty;
}}

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 24


In the screenshot below, I have added a front-end view showcasing the result
of the display method. The physical inventory value is calculated
automatically and displayed dynamically without being stored in the
database

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 25


[Link] Method

 In Dynamics 365 Finance & Operations, an Edit Method is used when we want to display
calculated or dynamically generated values that users can modify and save.
Unlike display methods, edit methods allow bidirectional data flow, meaning users can
both view and update the field values.

Uses of Edit method:

 Retrieves data dynamically.


 Allows users to edit the value and save changes.
 Is attached to a form control

Uses the [Edit] attribute to indicate that it allows modifications

05/23/2024 3K TECHNOLOGIES CONFIDENTIAL 26


In the screenshot below, I have demonstrated the steps I followed to implement an edit method.
Specifically, I created a new table and added a group field within the table structure. Within this group field,
I incorporated the necessary fields to store the required data. Additionally, I implemented an edit method in
the table to enable dynamic data modification

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 27


I written code for Edit method below I added code snippet what I written
public class TKT_VrcVehicle extends common
{
/// <summary>
///
/// </summary>
public edit Phone editPhone(boolean _set, Phone _phone)
{ Phone phoneWithFormatting;
if (_set)
{ [Link] = TKT_VrcVehicle::removeFormattingFromPhoneNumber(_phone);
} phoneWithFormatting = TKT_VrcVehicle::addFormattingBackToPhoneNumber([Link]);
return phoneWithFormatting;
} public static Phone removeFormattingFromPhoneNumber(Phone _phone) {
Phone phoneWithoutFormatting;
//Remove everything except numbers.
str pattern = @"[^\d]";
phoneWithoutFormatting = [Link]::Replace(_phone, pattern, "");

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 28


return phoneWithoutFormatting;
}
public static Phone addFormattingBackToPhoneNumber(Phone _phone)
{ Phone phoneWithFormatting;
Phone phoneWithoutFormatting;
//Remove everything except numbers.
str pattern = @"[^\d]";
phoneWithoutFormatting = [Link]::Replace(_phone, pattern, "");
if (phoneWithoutFormatting != "")
{
//Add formatting back to phone number
phoneWithFormatting = strFmt("(%1) %2-%3"
,subStr(phoneWithoutFormatting, 1, 3)
,subStr(phoneWithoutFormatting, 4, 4)
,subStr(phoneWithoutFormatting, 8, 3));
} else {
phoneWithFormatting = "";
} return phoneWithFormatting;
}}

05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 29


05/23/2025 3K TECHNOLOGIES CONFIDENTIAL 30

You might also like