Events

There are many scenarios where a Server Event in Pricefx needs to trigger an action in an external system, for example:

  • A Quote or Price List gets exported to an external system immediately on approval.

  • The completion of an Analytics Data Load notifies the Integration Manager which can then continue with next integration tasks.

  • A scheduled task can send custom Event to Integration Manager to trigger certain action.

What's a Pricefx Server Event

When certain actions occur in Pricefx, such as the creation of a Price List, Pricefx can fire/generate an event.

Examples of cases, when events are generated, are:

  • Approval of Price Lists

  • Approval of Live Price Grid items

  • Approval of Quotes

  • Calculated Field Set (CFS) calculation finishes

  • Update of Price Record

  • Analytics Data Load finishes

The server event is a small piece of information, stored as a record in the EventTask table.

EventsScreen.png
Figure 1. Example of a page with Pricefx Events

The Event has the following fields:

  • Event Type - Displayed as Name. See the Event Types section below for a list of types.

  • Other detailed information (depends on the type of the Event)

    • ID of the document/process on which the action/situation happened.

How Events are Consumed

The Events can be consumed in many ways, for example:

  • By Integration Manager - either by Push or Pull method.

  • By a Logic (e.g., by a Calculation Flow) in Pricefx Core - by reading the records of the EventTask table.

  • By an external system - either by Push or Pull method.

Principle / Flow

Let's explain the principle on an example of Price List export after its approval:

  1. Pricing Manager

    1. Creates a Pricelist and waits for its calculation.

    2. Reviews the Prices List and submits it for approval.

  2. Approver

    1. Approves the Price List.

  3. Pricefx Core

    1. Creates an Event (record) and stores it in a table EventTask (type code: EVT).

    2. If the Push Event is required, it pushes a message with the Event to the Integration Manager over an HTTP request.

  4. Integration Manager

    1. If Pull Event is required, it pulls the list of new Events from the EventTask table via the Pricefx Core REST API.

    2. Reads the records of the Price List from the PL/PLI tables (via the Pricefx REST API).

    3. Converts the PLI records to the shape required by an external system (CSV, XML, …​) depending on the project needs.

    4. Sends the converted records to the external system (the channel depends on project needs).

Pull Events from Pricefx to IM

  1. Pricefx Core

    1. Stores the Events to the EventTask table,

      • field Retries Left is set to 5,

      • field Response is set to 0.

    2. But it does not push them to the external endpoint (usually Integration Manager).

  2. The Integration Manager (or potentially some external service)

    1. Is reading the Events regularly (by default every 10 seconds) from the EventTask via the Pricefx REST API

      • The IM can filter which events to read.

    2. When it finds a new Event, it will proceed accordingly.

    3. If the processing of the Event is successful, it will update the Retries Left (set to 0) and Response field in the EventTask table (via Pricefx REST API call).

In comparison with the Push method, Pull has the advantage that the IM can download only the event types, that it wants to process at the moment.

For more details on IM configuration of the Pull Events, see IM Events docs.

Push Events from Pricefx to External Endpoint

The endpoint can be any external service that can accept an HTTP request with JSON data.

  1. Pricefx Core

    1. Stores the Events to the EventTask table,

      • field Retries Left is set to 5,

      • field Response is set to 0.

    2. Sends (over HTTP POST) also a message with the Event data to the external endpoint (usually Integration Manager).

      1. The unsent messages (with Retries Left > 0) are sent regularly (by default every 1 minute) to Integration Manager.

      2. The response status code of that call is stored in the field Response.

      3. When the IM replies with success (Status 200), Pricefx will set Retries Left to 0, so that it does not try to send it again.

      4. When the IM is down (or not responding), the Retries Left counter is decreased by one.

        This could lead to a "lost Event", i.e., the Event will never get to the IM because IM was down during the timeframe, when Pricefx tried to deliver it. Bear it in mind, when you design the integration.

  2. The Integration Manager

    1. Is listening for the Event messages.

    2. Once it receives a new Event, it will proceed accordingly.

For more details on IM configuration of the Push Events, see IM Events docs.

Event Types

There are many types of Events, which are generated automatically by Pricefx Core.

Area

Event

Description

Related to finished job processing

CALCULATION_COMPLETED_PL

Price List calculation finished

CALCULATION_COMPLETED_SIM

Simulation calculation finished

CALCULATION_COMPLETED_CFS

Calculated fields set process finished

CALCULATION_COMPLETED_PG

Price Grid (LPG) calculation finished

CALCULATION_COMPLETED_RC

Rebate Records (RR) calculation finished

CALCULATION_COMPLETED_CG

Calculation Grid (CG) calculation finished (since version 10.0)

PADATALOAD_COMPLETED

Analytics Data Load process finished

ASYNC_LOADDATA_COMPLETED

Asynchronous data upload finished

CONDITION_RECORD_CREATION_FINISHED

Condition Record Creation Logic finished. Message contains the following data: (since version 14.0)

  • jobId - Job ID

  • sourceObjectId - Source object ID

  • changedCRSetIds - ID of changed Conditional Records sets

  • processToken - process token unique for all splicing processes (if more than one) created

Related to a failed job processing

JOB_FAILED

When any scheduled job failed (Price List calculation, Data Load, CFS,… ), i.e., whatever you can find in the JST table with the status Error

Related to approval workflow

ITEM_APPROVED_CGI

Calculation Grid line item approved (since version 13.0)

ITEM_APPROVED_CT

Agreements & Promotions document approved

ITEM_APPROVED_PGI

Price Grid (LPG) line Item approved

ITEM_DENIED_CGI

Calculation Grid line item denied (since version 13.0)

ITEM_DENIED_PGI

Price Grid (LPG) line Item denied

ITEM_APPROVED_PL

Price List approved

ITEM_APPROVED_Q

Quote approved

ITEM_APPROVED_RR

Rebate Record approved

ITEM_APPROVED_DCR

Data Change Request approved

ITEM_APPROVED_RBA

Rebate Agreement approved

ITEM_APPROVED_CL

Claim approved

ITEM_APPROVED_CO

Compensation Plan approved (since version 13.0)

ITEM_APPROVED_COR

Compensation Record approved (since version 13.0)

WORKFLOW_MESSAGE

Whenever an approver approves (or denies) an Approval Step

WORKFLOW_SUBMIT

When an approvable document is submitted

Related to data updates

ITEM_UPDATE_RR

Rebate Record updated

ITEM_UPDATE_PR

Price Record updated (add/update/delete)

ITEM_UPDATE_PGI

Price Grid line item updated (manual data change of the record)

ITEM_UPDATE_MPLI

Manual Price List line item updated (add/update/delete – detailed info about the operation, contains the MPLI record detail)

ITEM_UPDATE_PPV

Any kind of Company Parameter value update (LTV or MLTVx) (add/update – the event contains the record itself)

ITEM_UPDATE_Q

Quote updated (when the Status changes, incl. revoked, superseded, invalidated). The event contains complete Quote Header information.

ITEM_UPDATE_CT

Agreements & Promotions document updated (incl. revoked, superseded, invalidated)

ITEM_UPDATE_CL

Claim Agreement updated

ITEM_UPDATE_CGI

Calculation Grid item updated manually (since version 10.0)

ITEM_UPDATE_RBA

Rebate Agreement updated (incl. revoked, superseded, invalidated)

ITEM_UPDATE_CO

Compensation Plan updated (since version 10.1)

ITEM_UPDATE_COR

Compensation Record updated (since version 13.0)

ITEM_PL_REVOKED

Price List revoked

CHANGE_NOTIFICATION_CA

Update of Customer Assignment (when Customer Assignment for Price List or Manual Price List changes)

CHANGE_NOTIFICATION_MPL

Update of an item of a Manual Price List (only informs that there is a change and in which Manual Price List)

CHANGE_NOTIFICATION_PP

Manual update of records in Company Parameter tables (add, edit, delete) and edit via Import Manager.

Custom

CUSTOM

Custom event created by a logic. This is used when you need to handle events which are not supported by Pricefx out of the box. Then you can generate your own events from the logic and let IntegrationManager do certain processing. To create a new custom event, use the function api.customEvent().

Custom Events

If you need to handle some events, which are not supported by the Pricefx Core out of the box, you can also generate your own Events from the Logic, and let Integration Manager do certain processing.

To create new custom Event, use the function api.customEvent().

Administration

Setup

Enable Events on Pricefx Server

The setup of Events is in the menu under Administration Configuration System Configuration General Settings Events.

EventsConfigurationScreen.png
Figure 2. Screen for configuration of Events
How to Switch Events On/Off:
  • To switch ON the generation of Events by Pricefx Core, you must set the value of the Event URL field and Save Changes of the setting.

    • If you plan to use PULL Events or you just want Pricefx to generate the Events without sending it anywhere, then simply use any dummy value here, e.g., "http://dummy_url".

    • If you want to use PUSH Events, then use the URL of a real Integration Manager end-point.

  • To switch OFF the generation of the Events, remove the value of the Event URL field and Save Changes of the settings.

How to Switch Push/Pull Events:
  • To set Push Events, ensure with the Integration team that the URL Event URL is correct and uncheck the checkbox Disable sending events thought HTTP (PUSH).

  • To set Pull Events, the URL Event URL must not be empty and ensure to check the checkbox Disable sending events thought HTTP (PUSH).

How to Switch Sending of Events by Email
  • Ensure to set a correct email to the Event Email field and Save Changes of the settings.

For more details, see the page Events in Documentation.

Filtering which Events Are Generated

By default, all event types are generated by Pricefx, when the Events are switched on. But, depending on the project, certain user actions can generate a lot of events (e.g., of type ITEM_APPROVED_PGI or ITEM_UPDATE_PPV), which you might not need to process but will be generated by Pricefx anyway (as a part of normal functionality). And if you're pushing the Events to Integration Manager, Pricefx will push all of the generated Events, even if you might not need them.

To select, which types of Events are generated for the partition, you must set the Event BitMask in the System AdminPartition Admin screen. This screen is available only to the superadmin, so you should ask Support to help you set it up.

The Event BitMask represents a list of Event Types, which you want Pricefx to generate for the given partition.

PartitionAdminEventBitMask.png
Figure 3. Setup of filter for Event types generated for the partition

Monitoring

In Pricefx UI, to open and review the list of all generated Events, navigate to Administration Logs Events.

EventsScreen.png
Figure 4. Screen with list of Events generated by Pricefx

You will find here all the generated events, stored in the table EventTask. Remember, the generation of Events depends on if it's allowed at all, and if there's any filter in the BitMask.

In the screenshot, the partition is set up for Pull Events, but there's no Integration Manager to read the Events, so they still have Retries Left set to 5.

You can notice that when you move your mouse over the Message, it shows the full content of the message in the tooltip.

For more details, see Server Events in Pricefx Documentation.

References

Pricefx Core Documentation

Groovy API

Integration Manager Documentation

Knowledge Base