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

Notifications

Announcements

No record found.

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
    133 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans