web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

API Nested loops using AL

(0) ShareShare
ReportReport
Posted on by 5

Hi, 

I create a Custom API using AL. I would like to work with nested loop in the api. I tried in many times, the nested loop is not working. Kindly help me to solve.

Here the code for reference.

Code:

area(content)
{
repeater(Group)
{
field(EmployeeCode; Rec."Employee No.")
{
Caption = 'Employee Code';
ApplicationArea = All;
}
part(employees; "Employees - API")
{
Multiplicity = ZeroOrOne;
Caption = 'Employees';
EntityName = 'employee';
EntitySetName = 'employees';
SubPageLink = "No." = FIELD("Employee No.");
}
field(FromDate; Rec."From Date")
{
Caption = 'From Date';
ApplicationArea = all;
}
field(ToDate; Rec."To Date")
{
Caption = 'To Date';
ApplicationArea = all;
}
field(Code; Rec."Cause of Absence Code")
{
Caption = 'Causes of Absence';
}
}
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    159 on at

    2 things. Not sure I understand why you loop through the employees api for an employee record. Surely that’s one record. If you find the standard employee api doesn’t have enough fields just create a new one based in the original with your fields.

    For page parts it is recommended to use a guid field for the pagelink: docs.microsoft.com/.../devenv-develop-custom-api

  • muthugtk Profile Picture
    5 on at

    Thank you for your response. I refer the sample way, but it cannot get it

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,119 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,522 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 1,177 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans