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:
MGCLatticeSalesTradeAgreementServiceA 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:
MGCLatticeSetSalesPriceResultThe outcome (Created / EditedInPlace / Superseded / RejectedComplex / Unchanged / Failed).
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeSetSalesPriceRequest | No | The 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:
MGCLatticeSetSalesPriceBatchResultThe batch envelope with one MGCLatticeSetSalesPriceResult per item, in request order.
| Name | Type | Optional | Description |
|---|---|---|---|
_requests | List | No | A list of MGCLatticeSetSalesPriceRequest contracts. |