Skip to main content

Lattice sales price effectivity events

What it does. Sends the Sales price agreement effective business event for each sales price whose From date has arrived, and Sales price agreement expired for each sales price whose To date has passed with no other price taking over, in every legal entity where those events are activated. Runs: automatically once a day as a background process. Who looks after it: Integration administrator (activating the events, and running it now in one legal entity); System administrator (the background process itself, on a standard page).

Purpose​

When a sales price reaches its From date or passes its To date, nothing is written to the database: the price was saved weeks earlier and simply starts or stops applying. No posting or table change can report that moment. This process watches the calendar instead, so a storefront, point-of-sale system or pricing engine subscribed to the two events switches prices on the day they take effect or lapse.

Without it, subscribers hear about a price only when it is created, changed or deleted (the events raised when a trade agreement journal is posted), and must work out the start and end dates themselves.

When it runs​

  • Once a day, at about the time of day the process was first registered; set Next execution to change it. It is one process for the whole environment and visits every legal entity that is not a virtual company, one after the other.
  • The database synchronization of a Lattice deployment registers it, and process automation must be initialized in the environment. There is no batch job for you to create.
  • Every poll creates a batch job named Lattice sales price effectivity events. Legal entities where neither event is activated are skipped without a message.
  • Each legal entity is swept for its own date: today in that legal entity's time zone. A price is reported effective on the first run on or after its From date, and expired on the first run after its To date.
  • An Integration administrator can run the same sweep now with Sales price agreement effectivity (effective/expired) events, for the current legal entity only.

Configuration and scheduling​

SettingWhereDefault
Whether a legal entity's prices are reportedSystem administration > Setup > Business events > Business events catalog: activate Sales price agreement effective and Sales price agreement expired (category Sales orders) for the legal entityNot activated
How often and when it runsSystem administration > Setup > Process automations, Background processes tab: select Lattice sales price effectivity events and choose Edit, then Repeat interval and Next execution on the Execution parameters tabOnce a day
A time of day when it does not runThe same dialog, Sleep time period groupNot set by Lattice
Run it now in the current legal entitySystem administration > Periodic tasks > Lattice business events > Sales price agreement effectivity (effective/expired) eventsNo fields
  • The two events are activated, and keep their places in the calendar, independently: you can activate only one.
  • The menu item checks the Lattice license first: while the license blocks Lattice it shows a warning and does not run. The background process is not stopped by the license.
  • Running the menu item, now or as a batch job of its own, alongside the background process sends nothing twice: each legal entity keeps one position per event, and both kinds of run move the same position.
  • A deployment keeps the interval, next execution and owner you set. The process cannot be switched off; to keep it out of busy hours, set Enabled sleep period or Next execution in Edit.
  • Process automations is a standard page that only the System administrator role opens. The menu item needs the Integration administrator role.

How it works​

In each legal entity where at least one of the two events is activated, the run does the Effective sweep, then the Expired sweep. Each sweep keeps a position: the date and record of the last sales price it dealt with.

  1. First run. The first time a sweep runs with its event activated, it only records its starting date (the run date for effective, the day before for expired) and reports nothing: "Sales price agreement effective: the sweep starts from ... Earlier dates are not reported." (or the same for expired). Prices that started or ended up to that date are never reported.
  2. Event not activated. A sweep whose event is not activated in the legal entity keeps its position and sends nothing: "Sales price agreement effective is not active in this company. Its sweep kept its position and will catch up once the event is activated." Once the event is activated again, the next run reports everything that started or ended in the meantime.
  3. Effective sweep. It takes the sales prices (trade agreement lines with relation Price (sales)) whose From date is after the position and on or before the run date, oldest first, and sends Sales price agreement effective for each one.
  4. Expired sweep. It takes the sales prices whose To date is after the position and before the run date. For each one it checks for another sales price of the same agreement (same account, item, currency, unit, quantity break and inventory dimensions) in effect on the day after that To date. If there is one, the price was replaced rather than left to lapse and no event is sent; otherwise it sends Sales price agreement expired.
  5. One price at a time. For each price, the event and the move of the position past that price are committed together, so an interrupted run resumes after the last committed price and nothing is sent twice.
  6. Throttle. After every 500 events the run pauses for a quarter of a second, so a large catch-up does not flood subscribers.
  7. Report. Each legal entity ends with "Sales price agreement effectivity run completed. Effective events sent: %1. Expired events sent: %2.", with the counts in place of %1 and %2 and the legal entity in front of the message.

A price saved with a From date the position has already passed (a back-dated price, or a price effective today that is created after today's run) is not reported as effective; the events raised when its journal was posted report it. A price whose From date is moved later after it was reported is reported again when the new date arrives.

Before it can run​

  • Process automation is initialized in the environment (System administration > Setup > Initialize process automations), Lattice was deployed with a database synchronization, which registers the process (a synchronization from Visual Studio registers nothing), and the batch service is running.
  • The business events framework is set up with an endpoint, and at least one of the two events is activated for the legal entity. See Activating an event and sending it somewhere.
  • Sales prices with From or To dates. Purchase prices and discount agreements are never reported.

Inputs and outputs​

WhatWhere you see it
ReadsSales price trade agreements of each legal entityThe standard trade agreement pages; LatticeSalesPriceAgreements
ReadsWhether each event is activated in the legal entityBusiness events catalog
WritesThe position of each sweep, one per legal entity and eventNot shown on any page
SendsSales price agreement effective and Sales price agreement expired, raised in the price's legal entityThe endpoint the event is activated for

The payload is described on the event pages: Sales price agreement effective and Sales price agreement expired. The process changes no price.

Monitoring and logs​

  • System administration > Setup > Process automations, Background processes tab: select the process and choose View most recent results. Each run shows "Lattice sales price effectivity events finished.", or "Lattice sales price effectivity events failed. The messages below give the reason; the process runs again at its next interval." with the messages.
  • System administration > Inquiries > Batch jobs: the batch job named Lattice sales price effectivity events. Its log holds the messages of each legal entity: the completion counts, a sweep that started, a sweep held because its event is not activated, and any warning.
  • Your subscriber: the events themselves. These two events are not written to the Lattice Business event log, so the business event reconciliation does not resend them.

When it fails​

SymptomCauseFix
No event arrivesThe event is not activated for the legal entity, the process is not running (process automation not initialized, Lattice deployed without the database synchronization that registers its processes, or the batch service stopped), or the run is the first one with the event activated (it only records its start)Activate the event; check the process; expect events from the next run on
"Sales price agreement effective is not active in this company. Its sweep kept its position and will catch up once the event is activated."The event is not activated in that legal entityActivate it if you want those prices; the next run catches up
"The Sales price agreement effective event for sales price record ... could not be sent. The sweep stopped at this price and will retry it on its next run." (or the expired event)Sending to the endpoint failedFix the endpoint; the next run retries that price and goes on from there
"The sales price agreement effectivity run failed in legal entity ... The other legal entities were still processed; this one is retried on the next run."An error in that legal entity's sweepRead the messages before it in the batch job's log; the next run tries again from the same position
A price was never reported as effectiveIt was saved after the sweep had passed its From dateUse the created, modified or superseded event of its journal for such prices
A lapsed price raised no expired eventAnother price of the same agreement was in effect on the next dayExpected: the price was replaced, not left to lapse
A price was reported only in one legal entity when run from the menu itemThe menu item covers only the legal entity it runs inExpected; the background process covers every legal entity

A failed send stops only that sweep in that legal entity, and the position never moves past an unsent price. A failure in one legal entity is reported as a warning and the run carries on with the next. These are handled inside the job, so View most recent results still records the run as finished; read the batch job's log. The batch framework does not retry the run.

Effect on the rest of Lattice​

  • It is the only source of the two events. If the process does not run (for example while the batch service is stopped), nothing is lost: once it runs again, each sweep catches up from its position.
  • It is independent of the events raised when a trade agreement journal is posted (Sales price agreement created, modified, superseded and deleted) and of the Sales price trade agreement changed event. A subscriber to both kinds hears about a price twice: when its journal is posted and when it takes effect.
  • A long catch-up (for example after an event was deactivated for weeks) can send many events in one run; the pause every 500 events spreads them out.