Skip to main content
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';
}
}
  • muthugtk Profile Picture
    5 on at
    RE: API Nested loops using AL

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

  • Suggested answer
    JAngle Profile Picture
    95 on at
    RE: API Nested loops using AL

    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

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans