I think there is a bug in the new Subscription & Recurring Billing module.
When I try to create a new document for a Customer from the Customer List or the Customer Card that has some recurring sales line setup with "Insert Rec Lines" = Automatic , once I click on a new field on the Document Page and the OnInsert trigger is executed I get an error saying that the record does not exist.
Expected behavior
I suspect that this piece of code on the codeunit 8074 "Document Change Management" is creating this issue because the Sales Header it's not inserted yet at that point.
local procedure IsRecurringBillingDocument(RRef: RecordRef) RecurringBilling: Boolean
var
SalesHeader: Record "Sales Header";
SalesLine: Record "Sales Line";
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
FRef: FieldRef;
begin
case RRef.Number of
Database::"Purchase Header", Database::"Sales Header":
begin
FRef := RRef.Field(8051); //Recurring Billing in Header Tables //Contract No. in Line tables
RecurringBilling := FRef.Value;
end;
Database::"Purchase Line":
begin
RRef.SetTable(PurchaseLine);
PurchaseHeader.Get(PurchaseLine."Document Type", PurchaseLine."Document No.");
RecurringBilling := PurchaseHeader."Recurring Billing";
end;
Database::"Sales Line":
begin
RRef.SetTable(SalesLine);
// Issue start here
SalesHeader.Get(SalesLine."Document Type", SalesLine."Document No.");
// Issue ends here
RecurringBilling := SalesHeader."Recurring Billing";
end;
end;
end;
I expect that a validation is performed to verify if the record already exists.
Steps to reproduce
Having some recurring sales line setup for a Customer.
If you try to create a Document for that Customer from the Customer List or the Customer Card
When you change the focus of the first field you get the following error:
When you look to the callstack, you get the following:
AL call stack:
"Document Change Management"(CodeUnit 8074).IsRecurringBillingDocument line 23 - Subscription & Recurring Billing by Microsoft
"Document Change Management"(CodeUnit 8074).PreventChangeOnDocumentHeaderOrLine line 16 - Subscription & Recurring Billing by Microsoft
"Document Change Management"(CodeUnit 8074).PreventChangeSalesLineType line 4 - Subscription & Recurring Billing by Microsoft
"Standard Customer Sales Code"(Table 172).ApplyStdCodesToSalesLines line 40 - Base Application by Microsoft
"Standard Codes Mgt."(CodeUnit 170).CheckCreateSalesRecurringLines line 13 - Base Application by Microsoft
"Sales Header"(Table 36).OnInsert(Trigger) line 21 - Base Application by Microsoft
Describe the issue
I think there is a bug in the new Subscription & Recurring Billing module. When I try to create a new document for a Customer from the Customer List or the Customer Card that has some recurring sales line setup with "Insert Rec Lines" = Automatic , once I click on a new field on the Document Page and the OnInsert trigger is executed I get an error saying that the record does not exist.
Expected behavior
I suspect that this piece of code on the codeunit 8074 "Document Change Management" is creating this issue because the Sales Header it's not inserted yet at that point.
I expect that a validation is performed to verify if the record already exists.
Steps to reproduce
Having some recurring sales line setup for a Customer.
If you try to create a Document for that Customer from the Customer List or the Customer Card
When you change the focus of the first field you get the following error:
When you look to the callstack, you get the following:
Additional context
No response