[Bug]: Service Contract Create Invoice skips Price Inv. Increase Code text when Standard Text Description is empty
Describe the issue
When creating a service invoice from a service contract (Create Service Invoice), the standard text / extended text linked via Price Inv. Increase Code on Service Contract Header is not transferred if the related Standard Text has an empty Description. If the Description contains any character (even a single space), the text is transferred correctly. Manually selecting the same standard text on a service invoice line works regardless of whether Description is empty.
Area
- Module: Service / Service Contracts
- Object: Codeunit 5940
ServContractManagement - Procedure:
CreateLastServiceLines - Field:
Service Contract Header."Price Inv. Increase Code"(table relation toStandard Text) - Related field:
Service Contract Header."Print Increase Text"
Expected behavior
If Price Inv. Increase Code is set and the Standard Text exists, Create Service Invoice should insert the text line and transfer extended text, even when Standard Text.Description is empty.
Description should be optional; the code and extended text are the functional content.
Steps to reproduce
- Create two Standard Text codes with extended text lines.
- Text A: Description empty, extended text present.
- Text B: Description =
" "(space) or any non-empty value, extended text present.
- On a signed service contract, set:
- Price Inv. Increase Code = Text A
- Ensure Print Increase Text = Yes (typically set when contract prices are updated).
- Run Create Service Invoice.
- Observe: index/standard text (and extended text) is missing.
- Change Price Inv. Increase Code to Text B and create the invoice again.
- Observe: index/standard text (and extended text) appears.
- On a service invoice, manually enter the same standard text code as Text A.
- Observe: text is inserted correctly even with empty Description.
Additional context
No response
I will provide a fix for a bug
- [x] I will provide a fix for a bug
In ServContractManagement.CreateLastServiceLines:
if ServContractHeader."Print Increase Text" then
if ServContractHeader."Price Inv. Increase Code" <> '' then
if StdText.Get(ServContractHeader."Price Inv. Increase Code") then begin
ServLine.Init();
ServLine."Document Type" := ServHeader."Document Type";
ServLine."Document No." := ServHeader."No.";
ServLine.Type := ServLine.Type::" ";
ServLine."No." := ServContractHeader."Price Inv. Increase Code";
ServLine."Contract No." := ContractNo;
ServLine.Description := StdText.Description;
if ServLine.Description <> '' then begin // <-- blocks empty Description
ServLineNo := ServLineNo + 10000;
ServLine."Line No." := ServLineNo;
ServLine.Insert();
if ServiceTransferExtText.ServCheckIfAnyExtText(ServLine, true) then
ServiceTransferExtText.InsertServExtText(ServLine);
ServLine."No." := '';
OnBeforeLastServLineModify(ServLine);
ServLine.Modify();
end;
end;
Proposed change:
procedure CreateLastServiceLines(ServHeader: Record "Service Header"; ContractType: Enum "Service Contract Type"; ContractNo: Code[20])
var
ServContractHeader: Record "Service Contract Header";
StdText: Record "Standard Text";
Cust: Record Customer;
ServiceTransferExtText: Codeunit "Service Transfer Ext. Text";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeCreateLastServLines(ServHeader, ContractType.AsInteger(), ContractNo, IsHandled);
if IsHandled then
exit;
ServContractHeader.Get(ContractType, ContractNo);
if ServContractHeader."Invoice Period" = ServContractHeader."Invoice Period"::None then
exit;
Cust.Get(ServContractHeader."Bill-to Customer No.");
if ServContractHeader."Print Increase Text" then
if ServContractHeader."Price Inv. Increase Code" <> '' then
if StdText.Get(ServContractHeader."Price Inv. Increase Code") then begin
ServLine.Init();
ServLine."Document Type" := ServHeader."Document Type";
ServLine."Document No." := ServHeader."No.";
ServLine.Type := ServLine.Type::" ";
ServLine."No." := ServContractHeader."Price Inv. Increase Code";
ServLine."Contract No." := ContractNo;
ServLine.Description := StdText.Description;
ServLineNo := ServLineNo + 10000;
ServLine."Line No." := ServLineNo;
ServLine.Insert();
if ServiceTransferExtText.ServCheckIfAnyExtText(ServLine, true) then
ServiceTransferExtText.InsertServExtText(ServLine);
ServLine."No." := '';
OnBeforeLastServLineModify(ServLine);
ServLine.Modify();
end;
end;
:robot: AI triage completed. Product group, please validate the triage report (Microsoft internal access only, use Ctrl+Click to open in new tab).
Was this triage helpful? React with :thumbsup: or :thumbsdown: on this comment to provide feedback.
Coverage: issue-only analysis of #12154; no code change reviewed; no implementation or fix proposed; repository evidence searched: codeunit 5940 ServContractManagement and callers, W1 service contract tests, country layers and src/Apps; history not searched; not covered: runtime reproduction, affected version, similar-issue history.
BC impact analysis
Affected areas
- Service Management - service contracts
- Service invoicing from contracts
- Standard and extended text
Reported severity and reproducibility: Wrong result - the standard text and extended text are missing on the created service invoice when the Standard Text Description is empty. Repro steps are specific (Deterministic).
Customer-facing behavior: Reported: the increase-text line is skipped on Create Service Invoice. Expected: the text and extended text are inserted even when Description is empty.
Existing tests
- Service Contracts.ContractPriceIncreaseText (codeunit 136102) - would not catch this; it does not use an empty-Description Standard Text
- Test codeunits identified: codeunit 136102 "Service Contracts"
Affected E2E scenarios
- Service contract, sign, then Create Service Invoice with price increase text
Existing tests for affected E2E scenarios
- Contract invoicing with price increase text: Service Contracts.ContractPriceIncreaseText (codeunit 136102) - Partial; detects exact behavior: No
- E2E test codeunits identified: codeunit 136102 "Service Contracts"
Localizations impacted: None identified
First-party apps impacted: None identified
Potentially impacted first-party apps: None identified
Recommendation: Recommend: Approve - Specific, deterministic repro and a clear expected result. No existing test covers an empty-Description Standard Text. Duplicate status is not confirmed because history was not searched.
Suggested test buckets to run in DME
- Buckets: RunALTests_W1_Bucket3; RunALTests_W1_Bucket4
- Unmapped / needs manual bucket assignment: none
A full regression and impact analysis was generated by scm-impact-agent.
@PredragMaricic, is there any SCM work or design decision that @JellebBE is waiting on, or is the next step for Jelle to open the PR? The reported case is specific: Create Service Invoice should carry over the extended text when the Standard Text description is blank. If a fix is already underway elsewhere, please link it here so we don’t duplicate it.
PR opened with the proposed fix: https://github.com/microsoft/BCApps/pull/14371