[EVENT] Also add RecordID to the current event that is already there.
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 683
- Forks
- 459
- Avg merge
- 3d 26m
- Merged PRs (30d)
- 633
Description
Why do you need this change?
I need to build a different filter for the Approval Entry and I need the RecordID for this.
Describe the request
In codeunit 1535 "Approvals **Mgmt." there is this function
procedure FindOpenApprovalEntryForCurrUser(var ApprovalEntry: Record "Approval Entry"; RecordID: RecordID): Boolean
begin
ApprovalEntry.SetRange("Table ID", RecordID.TableNo);
ApprovalEntry.SetRange("Record ID to Approve", RecordID);
ApprovalEntry.SetRange(Status, ApprovalEntry.Status::Open);
ApprovalEntry.SetRange("Approver ID", UserId);
// Initial check before performing an expensive query due to the "Related to Change" flow field.
if not ApprovalEntry.IsEmpty() then
ApprovalEntry.SetRange("Related to Change", false);
**OnFindOpenApprovalEntryForCurrUserOnAfterApprovalEntrySetFilters(ApprovalEntry);**
exit(ApprovalEntry.FindFirst());
end;
In here there is the event OnFindOpenApprovalEntryForCurrUserOnAfterApprovalEntrySetFilters. It now olny contains the Approval Entry. I would also like to include the RecordID
SO the function becomes
procedure FindOpenApprovalEntryForCurrUser(var ApprovalEntry: Record "Approval Entry"; RecordID: RecordID): Boolean
begin
ApprovalEntry.SetRange("Table ID", RecordID.TableNo);
ApprovalEntry.SetRange("Record ID to Approve", RecordID);
ApprovalEntry.SetRange(Status, ApprovalEntry.Status::Open);
ApprovalEntry.SetRange("Approver ID", UserId);
// Initial check before performing an expensive query due to the "Related to Change" flow field.
if not ApprovalEntry.IsEmpty() then
ApprovalEntry.SetRange("Related to Change", false);
**OnFindOpenApprovalEntryForCurrUserOnAfterApprovalEntrySetFilters(ApprovalEntry, RecordID);**
exit(ApprovalEntry.FindFirst());
end;
and the event becomes
[IntegrationEvent(false, false)]
local procedure OnFindOpenApprovalEntryForCurrUserOnAfterApprovalEntrySetFilters(var ApprovalEntry: Record "Approval Entry";RecordID: RecordID)
begin
end;
Provide an implementation (optional)
- I will provide the implementation for this extensibility request
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codeunit 1535 "Approvals Mgmt." and locate FindOpenApprovalEntryForCurrUser and its OnFindOpenApprovalEntryForCurrUserOnAfterApprovalEntrySetFilters event. Update the event invocation and declaration to include RecordID, then verify that the codeunit compiles and the event exposes both ApprovalEntry and RecordID to subscribers.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100