The first step is to create a trigger. After following the standard method for creating a new trigger, you will then need to select "Order change" as the event, and "Add cost" as the action. In the condition, you should specify on what under which circumstance the trigger should be executed.
For information about how to create a trigger, see the related article.
Next, you should specify the cost item that will be created by the trigger, as well as the amount. For example, a cost item could be a bonus for employees, with the amount being £100.
Note
The amount is specified as a prime number. The currency is substituted for it automatically from the one that is selected by default.
The "Date" field is for the date when the cost item was created. If the field is empty, the date of the trigger execution will be used by default.
You can use expressions in the "Amount" and "Date" fields. For example:
- to calculate a bonus for an employee (depending on the order amount), write the following expression:
order.totalSumm * 0.01
; - the date in the cost item can be bound to any date in the order using
order.createdAt
.
Objects available in the trigger filter can be used in the "Comment" field. Only text without html is allowed.
Result: in our example, when creating an order, a cost with the item "Bonuses for employees" in the amount of 100 euros will be automatically created and refers to the employee "Manager 2".
How to work with finances is described in detail in the related section.
Details on triggers are also available in the related section.