Skip to content

[Subscription Billing]Calculating initial dates correctly#6352

Merged
djukicmilica merged 4 commits intomicrosoft:mainfrom
miljance:SBCalculatingInitialDates
Feb 10, 2026
Merged

[Subscription Billing]Calculating initial dates correctly#6352
djukicmilica merged 4 commits intomicrosoft:mainfrom
miljance:SBCalculatingInitialDates

Conversation

@miljance
Copy link
Contributor

@miljance miljance commented Jan 28, 2026

Summary

This PR addresses two reported issues in Subscription Billing related to incorrect or missing updates of subscription line dates (Subscription Line End Date / Service End Date, Term Until, and Cancellation Possible Until).

Fixed Issues

  1. Initial subscription dates not calculated correctly when Subsequent/Extension Term is defined
    When posting Ship and Invoice from a Sales Order containing a Subscription Item with both Initial Term and Subsequent Term filled, the Subscription Line Start Date updated correctly, but Service End Date and Term Until remained empty.
    The root cause was logic that skipped initial end-date calculations when a Subsequent/Extension Term existed.
    Changes introduce a new internal procedure CalculateInitialSubscriptionDates() in Subscription Line that always calculates both Service End Date (via CalculateInitialServiceEndDate()) and Term Until (via CalculateInitialTermUntilDate()). Calls in Sales Documents, Create Subscription Line, Post Sub. Contract Renewal, and Subscription Header now use this consolidated procedure, ensuring initial dates are set correctly regardless of Subsequent/Extension Term presence.

  2. Cancellation Possible Until and Term Until not recalculated when Service Start Date is modified
    On non-invoiced subscription lines (e.g., after "Extend Contract" or manual edit), changing Service Start Date did not automatically update Cancellation Possible Until or Term Until. The "Update Subscription Line Dates" action also failed to update these fields.
    The refactor ensures consistent date recalculation:

    • CalculateInitialTermUntilDate() now prioritizes existing Subscription Line End Date when set and always updates Cancellation Possible Until via UpdateCancellationPossibleUntil().
    • Consolidated initial date calculation improves reliability when start dates change before invoicing.

Additional Improvements

  • Simplified and standardized the Extension Term tooltip across multiple pages (e.g., Service Commitments, Planned Service Commitments, Customer Contract Lines) by removing outdated references to conditional end-date setting, reflecting the new always-calculate-initial behavior.
  • Added propagation of Renewal Term to Sub. Contr. Analysis Entry for better data consistency in contract analysis.

These changes improve reliability of automatic date calculations, reduce manual corrections, and align behavior with expected subscription lifecycle rules without affecting existing renewal logic for subsequent periods.

Technical code review from @samra-singhammer or @sit-zm required prior to approval by Microsoft.

Work Item(s)

Fixes #6132
AB#620493

@miljance miljance requested a review from a team as a code owner January 28, 2026 15:51
@github-actions github-actions bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork labels Jan 28, 2026
@JesperSchulz JesperSchulz added the Finance GitHub request for Finance area label Jan 29, 2026
@JesperSchulz JesperSchulz reopened this Jan 29, 2026
Copy link

@sit-zm sit-zm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Miljan,

Please review my comments and decide whether some changes are required.

@github-actions github-actions bot added the Linked Issue is linked to a Azure Boards work item label Feb 3, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Feb 3, 2026
@miljance miljance requested a review from sit-zm February 3, 2026 15:38
@djukicmilica djukicmilica reopened this Feb 9, 2026
@djukicmilica djukicmilica merged commit 4e1d2b6 into microsoft:main Feb 10, 2026
87 of 89 checks passed
djukicmilica pushed a commit that referenced this pull request Feb 12, 2026
…6639)

<!-- Thank you for submitting a Pull Request. If you're new to
contributing to BCApps please read our pull request guideline below
* https://github.com/microsoft/BCApps/Contributing.md
-->
#### Summary <!-- Provide a general summary of your changes -->
This is a backport of the PR
#6352

#### Work Item(s) <!-- Add the issue number here after the #. The issue
needs to be open and approved. Submitting PRs with no linked issues or
unapproved issues is highly discouraged. -->
Fixes #6132

[AB#618064](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/618064)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Finance GitHub request for Finance area From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Subscription Line End Date and Term Until does not update automatically correct value

5 participants