[Subscription Billing]Calculating initial dates correctly #6352
+194
−152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, andCancellation Possible Until).Fixed Issues
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 Dateupdated correctly, butService End DateandTerm Untilremained 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 bothService End Date(viaCalculateInitialServiceEndDate()) andTerm Until(viaCalculateInitialTermUntilDate()). 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.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 Datedid not automatically updateCancellation Possible UntilorTerm Until. The "Update Subscription Line Dates" action also failed to update these fields.The refactor ensures consistent date recalculation:
CalculateInitialTermUntilDate()now prioritizes existingSubscription Line End Datewhen set and always updatesCancellation Possible UntilviaUpdateCancellationPossibleUntil().Additional Improvements
Extension Termtooltip 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.Renewal Termto 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