Codeunit 18008290 EOS Commission Setup Mgt.

Codeunit 18008290 EOS Commission Setup Mgt.

Central management codeunit for Commission Setup configuration and feature flags.

This codeunit serves as the single source of truth for all commission-related settings and feature flags. It uses SingleInstance to maintain consistent state across all calls within the same session.

Key Responsibilities:

  • Provides access to the Commission Setup record with caching for performance
  • Manages feature flags for: Sales Network, New Sales Engine, Salesperson Integration
  • Controls internal state flags for table modification permissions
  • Handles feature flag registration and enable/disable logic

Feature Flags Managed:

  • New Salesperson Engine: Controls the new salesperson management system
  • Sales Network: Enables sales network functionality
  • Salesperson Integration: Controls salesperson integration features

Internal State Flags:

  • SalespersonTreeModifiable: Allows modifications to Salesperson Set Entry and Tree Node tables
  • RoleSalespersonSetsDeletable: Allows deletion of Role-Salesperson Sets
  • DocumentBatchImportMode: Enables batch import mode for documents
  • AutomatedTestsMode: Indicates automated test execution

Caching Strategy:

  • Setup data is cached and refreshed every minute
  • Feature flags use tri-state (Undefined/True/False) for lazy loading
  • ForcedSetup flag bypasses normal cache refresh for testing

Usage:

  • Call IsNewSalesEngineEnabled(), IsSalesNetworkEnabled() to check feature status
  • Use SetSalespersonTreeModifiable(true) before modifying protected tables
  • Call GetCommissionsSetup() to retrieve cached setup record

Methods

GetCommissionsSetup

procedure GetCommissionsSetup(): Record "EOS Commissions Setup"

Returns the cached Commission Setup record. Automatically reloads the setup if the cache has expired.

Parameters / Return Value

  • Returns Record "EOS Commissions Setup"

    The Commission Setup record


ShowSalespersonField

procedure ShowSalespersonField(): Boolean

Determines whether the Salesperson field should be displayed. Returns true if no Primary Salesperson Role is configured.

Parameters / Return Value

  • Returns Boolean

    True if the salesperson field should be shown


IsSalespersonIntegrationEnabled

procedure IsSalespersonIntegrationEnabled(): Boolean

Returns if the Salesperson Integration is enabled.

Parameters / Return Value

  • Returns Boolean

IssalesNetworkEnabled

procedure IssalesNetworkEnabled(): Boolean

Returns if the sales network is enabled.

Parameters / Return Value

  • Returns Boolean

IssalesNetworkEnabled

procedure IssalesNetworkEnabled(RaiseErr: Boolean): Boolean

Returns if the sales network is enabled.

Parameters / Return Value

  • RaiseErr Boolean

  • Returns Boolean


IsNewSalesEngineEnabled

procedure IsNewSalesEngineEnabled(): Boolean

Returns whether the new sales engine is enabled. The new sales engine provides enhanced salesperson management with Role-Salesperson Sets and Salesperson Set Tree structures.

Parameters / Return Value

  • Returns Boolean

    True if the new sales engine feature flag is enabled


RaiseErrorIfNewSalesPersonEngineIsDisabled

procedure RaiseErrorIfNewSalesPersonEngineIsDisabled()

Raises an error if the new salesperson engine is not enabled. Use this to guard functionality that requires the new engine.


RaiseErrorIfNewSalesPersonEngineIsEnabled

procedure RaiseErrorIfNewSalesPersonEngineIsEnabled()

Raises an error if the new salesperson engine is enabled. Use this to guard legacy functionality that is incompatible with the new engine.


SetSingleRecordDefaultCustNetwork

procedure SetSingleRecordDefaultCustNetwork(var CustNetworkCombination: Record "EOS Cust. Network Combination")

Sets the default record for the customer network combination. If there is only one combination of “Customer No.” and “Ship-to Code” in the table, then it will have the Default field set to true automatically.

Parameters / Return Value

  • CustNetworkCombination Record "EOS Cust. Network Combination"

    The customer network combination record to check


TestSalespPurchSetup

procedure TestSalespPurchSetup()

[OBSOLETE] Tests if the salesperson/purchaser setup exists. This method is deprecated and will be removed in version 26.0.


UpdateSalespPurchFromHeader

procedure UpdateSalespPurchFromHeader(HeaderType: Integer; HeaderSubtype: Integer; HeaderID: Code[20]; HeaderSubID: Code[20]; HeaderRefNo: Integer; SalespPurchRole: Code[10]; SalespPurchCode: Code[20])

[OBSOLETE] Updates additional salesperson/purchaser from document header. This method is deprecated and will be removed in version 26.0. The new sales engine uses Salesperson Set Entry instead.

Parameters / Return Value

  • HeaderType Integer

    The header type identifier

  • HeaderSubtype Integer

    The header subtype identifier

  • HeaderID Code[20]

    The header document number

  • HeaderSubID Code[20]

    The header sub-identifier

  • HeaderRefNo Integer

    The header reference number

  • SalespPurchRole Code[10]

    The salesperson/purchaser role code

  • SalespPurchCode Code[20]

    The salesperson/purchaser code



EOS Labs -