microsoft / microsoft/ALAppExtensions
[Event Change Request] table 77 "Report Selections" Event OnGetEmailBodyVendorTextOnAfterNotFindEmailBodyUsage
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 988
- Forks
- 692
- Avg merge
- 49m
- Merged PRs (30d)
- 1
Description
Why do you need this change?
In a previous request by @fvet, a begin/end was requested, because it makes the event useless otherwise.
Even though this request was completed: https://github.com/microsoft/ALAppExtensions/issues/28346
The code still lacks the "begin" and "end" that is needed to prevent an exit(false); from happening when it shouldn't.
There might have been a mix up with the 2x GetEmailBodyForVend procedures, but the newest one is lacking the requered begin/end.
Describe the request
We need the mentioned begin/end as in the code below in order for the event to be usable correctly.
Otherwise we set the EmailBodyUsageFound to true, but the exit(false) is preventing further use of the data we've set up on the event: OnGetEmailBodyVendorTextOnAfterNotFindEmailBodyUsage, but in the newest version of the procedure 'GetEmailBodyForVend'.
Code with the additions:
procedure GetEmailBodyForVend(var EmailBody: Codeunit "Temp Blob"; ReportUsage: Enum "Report Selection Usage"; RecordVariant: Variant;
VendorNo: Code[20]; var VendorEmailAddress: Text[250]) Result: Boolean
var
TempBodyReportSelections: Record "Report Selections" temporary;
FoundVendorEmailAddress: Text[250];
IsHandled, EmailBodyUsageFound : Boolean;
#if not CLEAN27
ServerEmailBodyFileCreated: Boolean;
ServerEmailBodyFilePath: Text[250];
#endif
begin
Clear(EmailBody);
IsHandled := false;
OnBeforeGetEmailBodyVendor(
ReportUsage.AsInteger(), RecordVariant, TempBodyReportSelections, VendorNo, VendorEmailAddress, IsHandled);
if IsHandled then
exit;
VendorEmailAddress := GetEmailAddressForVend(VendorNo, RecordVariant, ReportUsage);
if not FindEmailBodyUsageForVend(ReportUsage, VendorNo, TempBodyReportSelections) then begin
IsHandled := false;
EmailBodyUsageFound := false;
OnGetEmailBodyVendorTextOnAfterNotFindEmailBodyUsage(
ReportUsage.AsInteger(), RecordVariant, VendorNo, TempBodyReportSelections, IsHandled, EmailBodyUsageFound);
if not EmailBodyUsageFound then begin//<----------Add this
if IsHandled then
exit(true);
exit(false);// --> wrong exit without the begin/end
end;//<----------Add this
end;
if TempBodyReportSelections."Email Body Layout Code" <> '' then
SaveReportAsHTML(TempBodyReportSelections."Report ID", RecordVariant, TempBodyReportSelections."Email Body Layout Code", ReportUsage, EmailBody)
else
SaveReportAsHTML(TempBodyReportSelections."Report ID", RecordVariant, TempBodyReportSelections."Email Body Layout Name", TempBodyReportSelections."Email Body Layout AppID", ReportUsage, EmailBody);
FoundVendorEmailAddress :=
FindEmailAddressForEmailLayout(TempBodyReportSelections."Email Body Layout Code", VendorNo, ReportUsage, Database::Vendor);
if FoundVendorEmailAddress <> '' then
VendorEmailAddress := FoundVendorEmailAddress;
This change will prevent the code from exiting when we have set "EmailBodyUsageFound" to true.
Thanks in advance!
Edit: Adding the information requested by github actions:
Alternatives evaluated: Explain which existing events or extensibility patterns were considered and why they are insufficient for this scenario. --> OnGetEmailBodyVendorTextOnAfterNotFindEmailBodyUsage was added, but there's a bug/flaw in the code that is ran after the event. Preventing the correct behavior.
Performance considerations: Describe the expected execution frequency and any anticipated performance impact. --> None, the impact on performance is not relevant here, we just need a fix so the code can function properly.
Data sensitivity review: Confirm whether this change would expose any sensitive data. --> No, only a mising begin/end are to be added, so no extra data is going to be exposed.
Multi-extension interaction considerations: Explain how conflicts or interactions with other extensions should be handled. --> By fixing the issue as suggested extensions will be able to use the event as it was intended.
Internal work item: AB#644837
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 at the GetEmailBodyForVend procedure and inspect the OnGetEmailBodyVendorTextOnAfterNotFindEmailBodyUsage event path shown in the issue. Confirm the EmailBodyUsageFound result controls whether the later exit(false) is reached, then validate the corrected behavior using the repository's available checks. Note that this repository states new pull requests are no longer accepted and contributions have moved to BCApps.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100