Why do you need this change?
We need to override the procedure that converts a sales document type integer into its display string inside ReturnSalesDocTypeString. The standard code uses a hardcoded case statement with label constants to return the string for each document type, but our customization requires using the "Sales Comment Document Type" enum's FromInteger and Format functions to derive the string, ensuring the output is always consistent with the enum's caption without maintaining separate label constants.
The standard implementation hardcodes label mappings for each integer value (0–9). All calls to ReturnSalesDocTypeString in the report depend on the returned string being correct for display purposes. There is no way to intercept or replace the return value after the procedure has already exited.
No event exists inside or around ReturnSalesDocTypeString that exposes the SalesDocType input and the Result output before the procedure returns. The procedure is local, so it cannot be overridden from a report extension.
Describe the request
Add an integration event OnBeforeReturnSalesDocTypeString in ReturnSalesDocTypeString in Report "Customer Deferred Revenue" before the case block, with an IsHandled guard to allow subscribers to fully replace the return value.
local procedure ReturnSalesDocTypeString(SalesDocType: Integer): Text
begin
IsHandled := false;
OnBeforeReturnSalesDocTypeString(SalesDocType, Result, IsHandled);
if IsHandled then
exit(Result);
case SalesDocType of
0:
exit(QuoteLbl);
1:
exit(OrderLbl);
2:
exit(InvoiceLbl);
3:
exit(CreditMemoLbl);
4:
exit(BlanketOrderLbl);
5:
exit(ReturnOrderLbl);
6:
exit(ShipmentLbl);
7:
exit(PostedInvoiceLbl);
8:
exit(PostedCreditMemoLbl);
9:
exit(PostedReturnReceiptLbl);
else
exit('');
end;
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnBeforeReturnSalesDocTypeString(SalesDocType: Integer; var Result: Text; var IsHandled: Boolean)
begin
end;
Alternatives evaluated:
No event currently exists inside or around ReturnSalesDocTypeString. The procedure is local, so report extensions cannot override it. Adding logic after the call to ReturnSalesDocTypeString in the trigger would be too late since the return value is already assigned to DocumentTypeString and cannot be intercepted without the event.
Why do you need this change?
We need to override the procedure that converts a sales document type integer into its display string inside
ReturnSalesDocTypeString. The standard code uses a hardcodedcasestatement with label constants to return the string for each document type, but our customization requires using the "Sales Comment Document Type" enum'sFromIntegerand Format functions to derive the string, ensuring the output is always consistent with the enum's caption without maintaining separate label constants.The standard implementation hardcodes label mappings for each integer value (0–9). All calls to
ReturnSalesDocTypeStringin the report depend on the returned string being correct for display purposes. There is no way to intercept or replace the return value after the procedure has already exited.No event exists inside or around
ReturnSalesDocTypeStringthat exposes theSalesDocTypeinput and the Result output before the procedure returns. The procedure is local, so it cannot be overridden from a report extension.Describe the request
Add an integration event
OnBeforeReturnSalesDocTypeStringinReturnSalesDocTypeStringin Report "Customer Deferred Revenue" before the case block, with an IsHandled guard to allow subscribers to fully replace the return value.Event Signature:
Alternatives evaluated:
No event currently exists inside or around ReturnSalesDocTypeString. The procedure is local, so report extensions cannot override it. Adding logic after the call to ReturnSalesDocTypeString in the trigger would be too late since the return value is already assigned to DocumentTypeString and cannot be intercepted without the event.