Skip to content

Conversation

@miljance
Copy link
Contributor

@miljance miljance commented Feb 6, 2026

Summary

This pull request refactors and enhances the Subscription Billing logic for creating Subscription Headers from sales transactions. The changes modernize the event handling by moving Subscription creation to the item journal posting process, improve data consistency by caching sales context, add new fields and data to the Subscription Header and Service Object, and streamline the handling of negative quantities. Several legacy methods are marked obsolete, and related code is cleaned up.

Event Handling and Refactoring:

  • Moved Subscription Header creation from shipment posting events to the OnAfterPostItemJnlLine event, ensuring that subscriptions are created during item journal posting and not during shipment posting. Legacy methods are now marked as obsolete and wrapped in conditional compilation.
  • Introduced global variables (GlobalSalesHeader, GlobalSalesLine) to cache sales context between event subscribers, ensuring accurate data is available during item journal posting. Added reset logic to clear these variables before and after posting.

Data Model and UI Enhancements:

  • Extended the Subscription Header with new fields. Updated logic to populate these fields from related sales and item records.
  • Updated the "Service Object" page to display the new fields under a new "Details" group for improved visibility and user experience.

Negative Quantity Handling:

  • Centralized and simplified the logic for handling negative quantities in subscription creation, ensuring a message is shown only once per posting and preventing subscriptions from being created for negative quantities.
  • Removed redundant negative quantity checks and messaging from Sales Subscription Line Mgmt., consolidating them into the main codeunit.

Code Cleanup and Dependency Updates:

  • Cleaned up obsolete code and unnecessary procedures, including removal of legacy event subscribers and negative quantity handling logic from secondary modules.

Awaiting code review from @samra-singhammer or @sit-zm.

Work Item(s)

Fixes #6320

Fixes AB#612906

@miljance miljance requested a review from a team as a code owner February 6, 2026 14:31
@github-actions github-actions bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item labels Feb 6, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Feb 6, 2026
djukicmilica
djukicmilica previously approved these changes Feb 9, 2026
@JesperSchulz JesperSchulz added the Finance GitHub request for Finance area label Feb 9, 2026
…scriptionHeaderTraceability

# Conflicts:
#	src/Apps/W1/Subscription Billing/App/Service Commitments/Pages/ServiceCommPackageLines.Page.al
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.

[BC Idea][Subscription Billing]: Sales orders pass on information on subscriptions

5 participants