Why do you need this change?
We want to filter the fetched GL entries of the consolidation on dimension 4.
But we are unable to because the OnBeforeGetGLEntries event doesn't provide the filter string.
The request is also send with a fixed filter.
We could make the request it, but then would have also need to reauthenticate, but against what Url?
Describe the request
A possible solution would be to have the filter part of the event, so we can update the filter string in a subscriber.
local procedure GetGLEntries(DateFilter: Text; AccountNoFilter: Text): JsonArray
var
Filter, Response: Text;
IsHandled: Boolean;
begin
Filter := '/generalLedgerEntries?$filter=' + DateFilter + ' and (' + AccountNoFilter + ')&$expand=dimensionSetLines', true)');
OnBeforeGetGLEntries(DateFilter, AccountNoFilter, IsHandled, Response, Filter);
if IsHandled then
exit(ParseData(Response));
exit(HttpGet(BusinessUnitAPIBaseUrl + Filter);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeGetGLEntries(DateFilter: Text; AccountNoFilter: Text; var IsHandled: Boolean; var Response: Text; var Filter: Text)
begin
end;
Likewise for OnBeforeGetGLEntriesCountAtDate
local procedure GetGLEntriesCountAtDate(GLAccountNo: Code[20]; ClosingDate: Date): Integer
var
Filter, Response: Text;
IsHandled: Boolean;
begin
Filter := '/generalLedgerEntries?$filter=' + GLAccountToFilter(GLAccountNo) + ' and postingDate eq ' + FormatDateForAPICall(ClosingDate));
OnBeforeGetGLEntriesCountAtDate(GLAccountNo, ClosingDate, IsHandled, Response, Filter);
if IsHandled then
exit(ParseCount(Response));
exit(HttpGetCount(BusinessUnitAPIBaseUrl + Filter);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeGetGLEntriesCountAtDate(GLAccountNo: Code[20]; ClosingDate: Date; var IsHandled: Boolean; var Response: Text; var Filter: Text)
begin
end;
Provide an implementation (optional)
Why do you need this change?
We want to filter the fetched GL entries of the consolidation on dimension 4.
But we are unable to because the
OnBeforeGetGLEntriesevent doesn't provide the filter string.The request is also send with a fixed filter.
We could make the request it, but then would have also need to reauthenticate, but against what Url?
Describe the request
A possible solution would be to have the filter part of the event, so we can update the filter string in a subscriber.
Likewise for
OnBeforeGetGLEntriesCountAtDateProvide an implementation (optional)