Triggers and their configuration in SalesRender

8 minutes

Triggers in SalesRender are automation rules, according to which an action occurs with an order or any other entity when a specific event occurs.

Triggers can be activated in succession, one after another, effectively automating much of the routine.

In this article, we will talk about the capabilities of our low-code editor and how to create a trigger in SalesRender. In a separate article, we will provide examples of interesting triggers from our users.

Triggers can be used to set up automatic bonuses for employees; assign orders to operators; populate fields with information; auto-send messages; change status after a certain time, and much more.

Triggers work not only with orders but also with any other entities. For example, a trigger can adjust employee balances or send them SMS messages.

For a trigger to work, it needs 2 elements:

  • what event to react to
  • what actions to take when this event occurs

"Event" when creating a trigger

The trigger event is the "trigger" after which the trigger will be activated. The event can only be selected when creating the trigger. This field cannot be edited later.

Events can be of several types:

  • Created
    • when the event is the fact of creation of something. For example, an order, client, product, warehouse, etc., is created.
  • Updated
    • when the event is the fact of updating something. For example, an order, client, product, warehouse, etc., is updated.
  • Logistics
    • when the logistics plugin updates the order status or if orders are unloaded through the logistics plugin.
  • Time
    • the event of current time occurrence. So, the event "Time" itself is just a clock that counts the current time, and when the time set in the order field with the type "Date/Time" matches the current time, the trigger is activated. For example, you need to remind the customer and plan to send them an SMS in 2 days at 09:00. In the order, there is a field with the type "Date/Time" where you set the date and time for sending the SMS. Then you set up the trigger for the "Time" event, and when the date and time you specified in the order occur, the trigger activates, and the SMS is sent.
  • Reminder
    • the event of the current time occurring in reminders for the order. It's the same type as "Time," only it works based on the "Reminder" field from the order.

After you have selected the event, for example, Created, a more detailed trigger form opens, in which the event type is already selected, and you need to fill in other mandatory fields.

"Actions" when creating a trigger

Actions are what should happen after the event occurs. For example, moving an order to another status, recording some information in the order, sending messages, awarding bonuses to employees, sending a webhook. In other words, any action can be set up for any event. Let's delve into what actions are available.

  • Trigger Actions
    • allows writing a new value to a variable. These actions only work with orders. For example, you can change the status of orders, data in order fields and carts, set a new reminder for the order. With this action, you can perform mass status changes of orders on a timer, assign orders to users, and so on.
  • Motivation
    • allows awarding motivation (bonuses) to users. Remember that each user has their own balance, which can be increased or decreased manually. With the "Motivation" action, this process can be automated. For example, awarding motivation to a user for selling a specific product. It can be configured very flexibly: choose a specific user/role or action performer, enter a specific amount, or calculate based on the cart amount.
  • Webhook
    • is a mechanism for notifying about events occurring in the system through callback functions. The principle of webhook operation is that as soon as any event occurs, a corresponding notification is immediately sent about it. In the settings of this action, you can select the URI to send the webhook to and choose the content type. Below in the editor, you can immediately check the code for errors.

  • Chat Messages

    • used solely for automatically sending messages based on pre-created templates.

  • Exclude

    • means that the trigger will turn the order into an "exception," where all validation and movement rules will be ignored, and the order will not be processed by any of your triggers. This action is necessary if some orders in the business process require individual processing, and you want to remove them from automatic processing to further contact the customer or send the shipment abroad, etc. Orders can only be removed from exceptions manually.

What is a "Filter" in a trigger

If you have selected an event and configured actions, your trigger is ready to work. However, there is another important element in setting up the trigger, which is the Filter.

The filter is needed when you want the trigger to first check certain conditions upon the event occurrence and only then execute actions. For example, if the action needs to be performed not with all orders, but only with those in a specific status.

Important: a trigger can perform multiple actions per event. For example, when updating an order, the trigger can:

  1. assign the order to a manager,
  2. award motivation to the same manager,
  3. send an SMS.

There can be many such variations.

All created triggers are displayed in a table:

In it, you can see:

  • Trigger Name
    • for convenience in work, visible only within the admin panel;
  • Event
    • shows at which event the trigger will start working;
  • Filter
    • displays all filters against which the event occurrence will be checked when the trigger is executed. For example, if you need not all orders but only those in a specific status, this is configured and displayed in the "Filter" field;
  • Date/Time Field
    • specifies the field with the type "Date/Time" that the trigger will work with;
  • Actions
    • specifies what exactly will happen to the order when the event occurs.

To understand when the trigger will fire, always refer to the Event column. If the event hasn't occurred, the trigger won't activate. And if the event has occurred but the trigger hasn't fired, check the filters, perhaps they are too strict and exclude the necessary orders.

Low-Code Editor Instruction

We remind you that we will set up triggers for you. All we need from you is a description of the task. However, we have still created a brief instruction so that you have an idea of how our editor works.

When creating a trigger, you will see such commands (variables, entities, functions, constants). They are present both when setting up actions and when setting up filters. How to work with them?

Important: the presence of all four commands does not mean that you need to use all of them for setup. You can use only what is necessary to write your expression.

Variables - these are all fields in orders. They can be both current and past states. For example, you can check the fact of status change by creating an expression "Current status in order" is not equal to (written as !=) "Previous status in order". Or you can append any value to any field by creating an expression "Current comment" + "Test comment".

Entities - these are all entities present in our system. When using this command, you will need to select a specific entity. For example, you want to select all orders that use the Post of Russia logistics plugin. In this case, you select the variable "Logistics plugin", equal to (written as ==) entity "Logistics plugin" and select specifically "Russian Post".

Functions - these are all data types.

Constants - this is a fixed list consisting of the following constants: "False", "True", "Null", "Now". This is needed to use expressions like "Is action performer user?" "True" or "Current time" "Now".

The following operators are available in the expression editor:

== means "equals"; != means "not equals"; > means greater than; >= means greater than or equal to; < means less than; <= means less than or equal to; AND (also written as &&) is a logical operator. It is used when there are multiple conditions in the trigger "Status must be this AND project must be this", meaning the conditions are strict; OR (also written as ||) is another logical operator, meaning OR. It is used in triggers when there are multiple conditions "Status must be "Processing" OR status must be "Callback". IN operator for working with arrays. With it, you can check the presence of products/promotions in the cart or the presence of a specific logistics status in the order; +, -, /, * arithmetic operators;

Important: if you use AND and OR in filters simultaneously, when constructing filters, you should know that AND will be executed before OR. Therefore, if you want the OR conditions to be checked first, put this action in parentheses. For example: (Order status is "Processing" OR order status is "Callback") AND project is "Hot Leads".

We'll be posting the most interesting trigger setup cases on our blog!

Our support team will help determine which triggers you need and will set everything up for free!

You can explore even more possibilities on our website salesrender.com

Subscribe to our channel on Telegram

Contact CEO Anna on Telegram

Thank you for your time 💚