Interpreting Automation logs

Every time Automation evaluates an order, a log is generated which details what actions were taken and why. If you are experiencing a problem with Automation these logs are a useful tool that could shed some light on the issue. This article will act as a guide to interpreting these logs to aid in troubleshooting.

The logs can be located under Settings > Brightpearl Apps > Automation, in the 'Activity Log' tab.

1.png

The logs consist of five columns:

  • Time: The time the evaluation was performed
  • Order ID: The order which was evaluated
  • Rule name: The rule against which the order was evaluated
  • Status: The outcome of the evaluation
  • Description: A description of what was done

The log can be filtered by Order ID, Rule name and Status.

Understanding log statuses

There are three possible statuses:

  • Pending: The order was evaluated and no action was taken
  • Completed: The order was evaluated and an action was successfully taken
  • Completed with errors: The order was evaluated and an action was taken, but was not successful

NOTE: ‘Pending’ entries are only kept for 24 hours before being purged.

By default, the logs will be filtered by ‘Completed’ and ‘Completed with errors’ entries.

This in itself can be useful, but next to every row in the status column is a link which says ‘details’:

2.png

Clicking on the link will bring up even more detailed logging that explains the logic behind the status.

This logging displays exactly what was evaluated, whether it met the conditions or not, and, if an action was taken, what the action was.

Conditions

Each condition has a separate entry in the log, formatted as follows:

condition-name(conditions) ✓
[order property], [condition]
condition-name condition has been executed with result (is) [true/false]

For example, if your condition is that the order status must be ‘New Web Order’, and the order meets that condition, you might see:

order-status(conditions) ✓
order.orderStatus.orderStatusId = 30 and options.orderStatus = 30
order-status condition has been executed with result (is) true

Where order-status is the name of the condition, order.orderStatus.orderStatusId = 30 is the order property, and options.orderStatus = 30 is the condition the order was being evaluated against.

Because the order status IDs match, the condition has been met.

The order must meet all conditions in order to be actioned.

Action-conditions

You will notice an additional entry in the log, formatted as follows:

action-name(action-conditions) ✓
[order property] and [action]
action-name action.condition has been executed with result [true/false]

This entry details the action that would be taken if all the conditions were met and evaluates whether that action is possible.

If a rule hasn’t run and the order meets all conditions, it may be that the action itself couldn’t be performed.

Actions

If an order has been actioned, the log entry will be in the ‘Completed’ or ‘Completed with errors’ status, and there will be an additional entry in the log.

Similarly to conditions, it’s formatted as follows:

action-name(actions) ✓
[Action taken]

The ‘Action taken’ is generally the same text as in the ‘Description’ column.

How to use the logs

The logs come in handy if you’re trying to work out:

  • why a rule acted on an order when it shouldn't have
  • why a rule didn’t act on an order when it should have

... since they detail exactly why a particular rule did or didn't run.

An example

Say you have a rule to fulfil orders which download from Channel A as long as they are fully paid. An order comes in overnight, and when it’s checked in the morning you can see that even though it’s been paid in full, it hasn’t yet been fulfilled. When you check the Automation logs, you can see that the log for the fulfilment rule has a status of ‘Pending’.

When you check the details, you see the following log:

channel(conditions) ✓
order.assignment.current.channelId = 5, condition.channelIds = 5
channel condition has been executed with result (is) true

order-status(conditions)
order.orderStatus.orderStatusId = 30 and options.orderStatus = 3
order-status condition has been executed with result (is) false

payment-status(conditions) ✓
order.orderPaymentStatus = PAID and condition.paymentStatus = PAID
payment-status condition has been executed with result (is) true

fulfill-order(action-conditions) ✓
action.allowsPartialFulfilment = false, action.allowsOtherWarehouses = false,
warehouseIds = 2, items = 1234, bundles = {},
products = {"1234":{"quantity":1,"bundle":false}} and productAvailability = {"1234":
{"total":{"inStock":1000,"onHand":900,"allocated":100,"inTransit":0},
"warehouses":{"2":{"inStock":1000,"onHand":900,"allocated":100,"inTransit":0}}}}
fulfill-order action.condition has been executed with result true

Looking at the log you can immediately tell that the order passed the channel condition and the payment condition, and it could be fulfilled. However the log states that the order status is ID 30, when it should be ID 3.

You now know there may be an issue with the order’s status, and can check it to make sure it matches the status in the rules.

Have more questions? Submit a request