Context

In general, a context can be used to limit where entities, attributes, or specific properties are considered when executing business logic within the fulfillmenttools platform.

Entities which allow contexts currently:

These entities contain a context field. The context is evaluated at runtime and determines whether the given object is considered for the given use case. If no context is defined, no limitations are set.

The structure of the context is depicted here:

{
    ...
    "context": [
        {
            "type": "FACILITY",
            "operator": "NOT",     // optional, not available in every entity
            "values": [
                "string"
            ]
        },
        ...
    ]
}
  • Entries in the context array are evaluated with a logical AND

  • Items of the values array are evaluated with a logical OR

  • each entity supports different types for context like: CATEGORY, FACILITY_ID and FACILITY_GROUP

  • The operator is optional, and we currently only support the value NOT. Not every entity supports this.

Example

Let us assume that we want to create a discount that applies only to certain facility groups and not to a specific article category.

Therefore, we introduce a context to the discount and define on which sales prices the discount is considered when routing an order.

See Facility Discounts for more documentation related to discounts.

{
    // discount entity
    ...
    "context": [
        {
            "type": "FACILITY_GROUP",
            "values": [
                "uuid-facility-group1",
                "uuid-facility-group2"
            ]
        },
        {
            "type": "CONTEXT",
            "operator": "NOT",
            "values": [
                "uuid-category1"
            ]
        },
    ]
}

In this example the discount is taken into account when:

  • the given facility is in facility group uuid-facility-group1 or uuid-facility-group2

and

  • the article category is not uuid-category1.

Last updated