Skip to main content

Task rules

Learn more about how to set up automated rules and actions that are triggered when certain Task-related conditions are met.

Written by eLogii

Task rules allow users to set up parameters and rules that will prompt the system to make desired changes to Tasks once they are in the system, provided that they contain elements that adhere to the preset rules.

There are two types of rules:

Task rules

Task rules are used to define sets of Task-related rules that dictate how the system will behave in case specified Task fields are populated with defined values. This feature can be found in Configuration ⇒ Task rules

Users can choose when they want the rule to trigger - once the Task that meets the criteria is created (the rule can trigger only once for that Task), once it's been updated (the rule can trigger multiple times, depending on the conditions set), or in both cases.

A single rule can have multiple conditions, and you can also organize conditions into groups. Once you’ve added your conditions and defined how they relate to each other, the rule applies whenever those conditions are met.
​

Each rule has two parts. The Source field sets the trigger, meaning the condition that causes the change. The Target field sets the result, meaning what should change when the rule applies.
​

For example, you could use a Task rule to change the priority of tasks that have specific skills and belong to a particular team.
​

AND means that a task must meet all of the conditions for the rule to apply. In this example, the rule only applies to tasks that have both the Junior and German skills and are assigned to Team 1. A task with the Junior and German skills that belongs to Team 2, or to no team at all, won’t be affected.

OR makes the rule much broader, because a task only needs to meet one of the conditions. With OR in the same example, the rule would apply to any task that either has the Junior and German skills or belongs to Team 1.

You can also group conditions and set the relationship within each group separately. This lets you build more complex rules from several layers of conditions. Here is an example of that;


You can use any of the allowed logical operators to define how eLogii constructs the rule. For example, if you would like to include all values that contain specific information, you would use =, and if you want to include all except for a specific value, you would use !=. The following operators are used to establish the relationships and actions between various task elements:

Operator

Name

Function

=

equals

Assigns values to entities - the left side holds the same value as the right side

!=

not equal to

Checks whether the values of two entities are equal or not. If the values are not equal, then the condition becomes true

>

greater than

Check if the value of the left side is greater than the right side. If it is, then the condition becomes true

>=

greater than or equal to

Check if the value of the left side is greater than or equal to the value of the right side. If it is, then the condition becomes true

<

less than

Check if the value of the left side is less than the value of the right side. If it is, then the condition becomes true

<=

less than or equal to

Check if the value of the left side is less than or equal to the value of the right side. If it is, then the condition becomes true

contains

contains

If the field contains a specified value, a desired action will be triggered.

begins with

begins with

If the contents of the field begin with a specific value, an action will be triggered.

ends with

ends with

If the contents of the field end with a specific value, an action will be triggered.

does not contain

does not contain

If the contents of the field do not contain a specific value, an action will be triggered.

does not begin with

does not begin with

If the contents of the field do not begin with a specific value, an action will be triggered.

does not end with

does not end with

If the contents of the field do not end with a specific value, an action will be triggered.

is null

is null

If the contents of the field are empty, an action will be triggered.

is not null

is not null

If any content is populating the selected field, an action will be triggered.

in

in

If a specific value is included in the contents of a list in the selected field, then an action will be triggered.

not in

not in

If a specific value is not included in the contents of a list in the selected field, then an action will be triggered.

between

between

If the number value of the selected field is between the specified range, an action will be triggered.

not between

not between

If the number value of the selected field is outside of the specified range, an action will be triggered.

It's also possible to add multiple target fields within a single rule. This means that you can add various actions to trigger once specific conditions are met. For example, if a Task with a particular reference is imported to the system, you can set a specific tag to apply, assign the Task to a Team, and set the priority of the Task all within a single rule.

Target Field Values

There are many target fields to choose from, and they depend on the target Task field that stores information.

  • text - relates to populating the fields that store string/text data types. You would choose text if you wish to set a particular skill or capability to a Task after conditions are met.

  • number - relates to populating specific fields that store data as integers/numbers. You would choose this if you wish to define a priority for a Task based on specific conditions, for example.

  • date - this field will be used if you wish to make changes to any fields that store date data.

  • color - this will prompt a color picker where you can pick a color that will be applied to the Tasks that meet the desired conditions.

  • true/false - refers to the validity of the defined target field.

  • fieldName - refers to another Task field in eLogii. It allows users to copy data from one field to another via automation.

  • JSON - allows users to write JSON expressions to get the desired outcome.

  • action - will prompt an action based on set conditions. At the moment, it's possible to unassign, create a new task, and update existing Tasks if conditions are met.

  • form -this option lets you replace a form applied as a POD action, for either pickup or delivery, when certain conditions are met. To set it up, select the segment whose form the rule should replace (pickup or delivery) and choose the form you want to use instead. Then, in the Which form action field, select 1st form action.

    If the POD segment has several forms (multiple actions of the same type), choose the action that matches the position of the form you want to replace, based on the order in which the forms are listed. For example, to replace the third form, select the 3rd form action.

  • items_form - this option applies the same logic as the one above; it just applies to POD actions on an item level.

Example of using Task rules

Using these operators, you can set up various things within eLogii.

If you’re not sure how a specific entity is named in eLogii, check the API documentation. You can also find the exact names of Task fields directly in eLogii: go to the Tasks section and click Export. A pop-up window will list all task fields with the exact name used for each one.

There’s no limit to the number of conditions you can add to a rule, and rules can also be triggered via the API.

Tasks Marked in Different Colors on the Map Based on Skill

For example, you can set specific Tasks to appear in a different color on the map by using the = operator. If you predefine a skill for these Tasks, you can use that condition as a rule, which will tell eLogii that the color rules apply only to Tasks that contain that specific skill.

In practice, the setup for this example would look something like this:

The result should be something like this. As seen in the example, the Tasks with the corresponding tag are marked with the color that corresponds to the defined Hex Code:

You can choose source and target fields from a list of Task fields or enter a custom one. The list automatically includes your dimensions and custom fields, as well as Task states and other options.

You can do many things with this feature, and it’s entirely up to you how you want to use it.

Sending Notifications based on set Parameters

Alongside changing the Task priority and changing the Task Display color on the map, you can also choose whether to send certain notifications (for example, if you want to exclude some notifications in specific cases for some customers).
​

Additionally, if you use Teams in your operations, you can set a rule for when Tasks are unviable because there aren't enough Drivers on a team to complete them; those Tasks can be transferred to another team that handles these situations.

Changing Forms Used by Drivers on Tasks

If a different form should be applied as a POD action when specific Task conditions are met, you can set this up with Task rules.

In the Condition section, add the conditions that must be met for the form override to apply. Once you’ve set up the condition elements and defined how they relate to each other, go to the Target field section and select Form as the target Task field.

In the Task segment section, choose whether the override applies to the pickup or the delivery part of the Task. If Field service mode is enabled or Single segment optimization mode is in use, select Delivery.

In the Which form action section, select 1st form action if the Task uses only one form. If Tasks have multiple forms, which is only possible when multiple actions of the same type are enabled, you need to specify which form the rule should replace. The form action number matches the order in which the forms are listed on the task. For example, if a Task has three forms and you want to replace the second one, select 2nd form action.
​

Testing Task rules

You can test your rules before enabling them. Once you’ve set up the conditions, click Test condition to open the testing panel. Copy the generated text from the Condition field into the Test data (JSON object) field to check whether the conditions work and whether eLogii can apply the result. The example below shows both a failed and a successful test.

If you’re comfortable with JSON, you can also write your own test data instead of copying the conditions.

If a test fails, go back and adjust the logic in your conditions. In the example above, the test failed because no drivers in Team 2 have the Junior skill.

Rule behavior

Task rules aren’t applied all at once. eLogii runs them one at a time, from top to bottom, so the order of your rules matters.

If several rules apply to the same task, make sure they don’t cancel each other out. For example, say rule A sets the priority to 1 for tasks weighing less than 30, and rule B sets the priority to 5 for tasks with certain skills. If rule B runs first, those tasks get priority 5, but rule A then changes it to 1. To keep priority 5 for those tasks, place rule A above rule B.

In other words, when two rules change the same field, the rule that runs last wins. A rule doesn’t consider values set by earlier rules; it simply overwrites them.

To change the order of your rules, drag a rule by its handle above or below other rules.

Creating exclusions within the follow-up rules can help combat overriding newly set data. For example, if you don't want the rule to apply to some cases, you can add parameters such as AND [property of choice] != (not equal to) [value you want to exclude] in all following rules.

It is also important to note that any changes made to the rules will not be applied retroactively. If you edit an existing rule and apply changes, those changes will not apply to Tasks that are already in the system; instead, they will only apply to Tasks added after the changes have been made or to Tasks that have been updated after the changes were applied.

Postcode rules

Postcode rules allow users to define which postcodes should be attributed based on a specific Driver, Team, Depot, or Skill. After specifying and saving these rules, all the Tasks uploaded after that will be matched with the specified Drivers, Teams, and/or Depots based on their Postcode. You can find them in Configuration ⇒ Task Postcode rules.

Partial matching

It's also possible to enable the Partial match toggle, which allows users to make postcode matches that do not include all elements in the original postcode.

The match can be either the start of the postcode, the middle, or something else. Partial matching helps save time with inputting postcode variations that would otherwise apply to the same rule. Depending on how you choose partial matching to behave, the rule will act accordingly and match the criteria.

To better illustrate, if we have a postcode SW3 1ES and if partial matching is not switched on, the rule with postcode SW3 will not match this Task, as it’s not identical. But with Partial matching set to match the start of the postcode, SW3 will be included in the rule because SW3 1ES contains SW3.
​

If you have some specific preferences regarding how you want Postcode rules to behave, you can resort to regular expressions. You can write the desired expression in the Match Postcode field and set which fields the rule will affect before saving. If you're not sure how to write a regular expression, feel free to contact our support team, and they will assist you.

Did this answer your question?