Announcements
Hello everyone, I am developing a Business Central extension to expose data in custom API pages. I am using the AL development to expose the API. One of my pages needs to include the G/L entry transactions and I need one field that is not present on the table, but it is present on the application.
We know that closing dates will and a "C" on the beginning of the dates. This is also a fictitious date generated by Business Central that will include a timestamp to the dates. G/L Entries that are included on the close income statement batches have a posting_date with this C.
I need to identify such transactions. I am exposing the posting date field on my AL.
In other words, I need to check if that specific G/L Entry is included in a closing batch.
Which field to use, and how does Business Central mark the G/L Entry with the "C" on the posting date? how to replicate this on an API page?
Hi gustavonery
if you are creating your own API and adding one field which is not present in standard API(G/L entries)
So either you copy the standard G/L entry API v1.0 and paste the entire code in your own API in additional to isCloseIncomeStatement field
and write a logic onOpenPage Trigger to set the value to true isCloseincomeStatement.
trigger OnOpenPage()
var
RecSourceCode: Record "Source Code Setup";
begin
RecSourceCode.Get();
Rec.SetFilter("Source Code", RecSourceCode."Close Income Statement");
if Rec.FindSet() then repeat
Rec.Validate(IsCloseIncomeStatement,true);
until Rec.Next()=0;
end;
If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much
This might give you some direction on how to code that part:
HELLO Vaishnavi Joshi, actually your answer helped me to find out that the source code can be used. However, my need is a little bit deeper. As you can see in the following image, I'm creating a new page of type API. I need to know how to make this in the AL language. I want to return true or false on the field "isCloseIncomeStatement" (line 24)
Hi,
To identify closing statement entries in G/L entries table use SourceCode field in GL entries which takes value from close income statement field present in source code setup page.
Also, Posting date contains a prefix 'C' for closing statement is because there is method ClosingDate(Date) which is used to add 'C' as prefix in the date. Refer the below link for more information.
docs.microsoft.com/.../system-closingdate-method
If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156