Description
Describe the issue
Currently it is possible to select Subscription Items in Purchase Invoices and if needed connect them to a Contract Line. However, users want to create Purchase Order and enter a subscription item also in a purchase order. This was possible with BC25 release of Subscription Billing, however, was affected with a change in BC25.2 so that this is no longer possible.
Expected behavior
Users should be able to create a purchase order and select a subscription item.
Steps to reproduce
- Create a purchase order
- Create a new line for a subscription item
- The error appears: Items that are marked as Subscription Item may not be used here. Please choose another item.
AL call stack:
"Sub. Contracts Item Management"(CodeUnit 8055).PreventServiceCommitmentItem line 5 - Subscription Billing by Microsoft version 26.2.34726.0
"Sub. Contracts Item Management"(CodeUnit 8055).PurchaseLineOnBeforeValidateEvent line 6 - Subscription Billing by Microsoft version 26.2.34726.0
Additional context
The error lies in a codeunit 8055 "Sub. Contracts Item Management":
There is no reason for function IsPurchaseOrderLineAttachedToBillingLine to exist as Billing Lines cannot be attached to a Purchase Order Line but only to Purchase Invoice Line or Purchase Cr. Memo Line.
[EventSubscriber(ObjectType::Table, Database::"Purchase Line", OnBeforeValidateEvent, "No.", false, false)]
local procedure PurchaseLineOnBeforeValidateEvent(var Rec: Record "Purchase Line")
begin
if Rec.Type = Rec.Type::Item then begin
if not Rec.IsLineAttachedToBillingLine() then
PreventBillingItem(Rec."No.");
if not Rec.IsPurchaseInvoice() and not Rec.IsPurchaseOrderLineAttachedToBillingLine() then
PreventServiceCommitmentItem(Rec."No.");
end;
end;
I will provide a fix for a bug
- I will provide a fix for a bug