Skip to main content

MGCLatticeSalesTradeAgreementService

Lattice service that lets an external system push sales prices into D365 as trade agreements (PriceDiscTable, relation PriceType::PriceSales), enforcing a clean, forward-only, one-price-per-(key,date) timeline by auto-superseding the prior open-ended price. It drives the standard D365 price/discount journal engine (create a PriceDiscAdmTable journal with PriceDiscAdmTrans lines, then validate + post via PriceDiscAdmCheckPost) - it never writes PriceDiscTable directly and never deletes.

Methods​

new​

Initializes a new instance of the MGCLatticeSalesTradeAgreementService class.

  • Visibility: public
  • Returns: void

No parameters.

construct​

Creates a new instance of the MGCLatticeSalesTradeAgreementService class.

  • Visibility: public
  • Returns: MGCLatticeSalesTradeAgreementService A new service instance.

No parameters.

setSalesPrice​

Upserts a single sales price as a trade agreement, applying the clean forward-only timeline rules. Never throws: any fault is captured on the result as outcome Failed with its ErrorCode and Errors. Success is true only for the outcomes that leave the requested price effective (Created, EditedInPlace, Superseded, Unchanged); RejectedComplex and Failed answer Success false. The operation has no preview: a request with PreviewMode set is refused (PreviewUnsupported) before anything runs.

  • Visibility: public
  • Returns: MGCLatticeSetSalesPriceResult The outcome (Created / EditedInPlace / Superseded / RejectedComplex / Unchanged / Failed).
NameTypeOptionalDescription
_requestMGCLatticeSetSalesPriceRequestNoThe sales-price push request.

setSalesPriceBatch​

Upserts a batch of sales prices, one journal per request (chunking into fewer journals is a v2 optimization). Each request is independent - one failure does not stop the rest. A missing (null) item fails on its own as ValidationFailed; a missing or empty list answers Success false with no results.

  • Visibility: public
  • Returns: MGCLatticeSetSalesPriceBatchResult The batch envelope with one MGCLatticeSetSalesPriceResult per item, in request order.
NameTypeOptionalDescription
_requestsListNoA list of MGCLatticeSetSalesPriceRequest contracts.