Automatic Rules in Fibery react to changes (update, create or delete) that happened with entities. For example, you closed a Task and want to set a Completion Date to Today.

Rules are linked to Types, you can add them in Type Editor. If you need to react to Task change, then the Rule should be defined in Task Type.

Rule consists of a Trigger (Task's state was changed) and an Action (update Comlpletion Date).

There are only two triggers so far:

  1. Entity Created

  2. Entity Updated (some field)

There are quite many actions, you can check all available actions here.

How to use rules

To add a rule, do the following:

  1. Open Type Editor

  2. Scroll down to the Rules section

  3. Click Add Rule link

Provide rule title, configure When and Then sections.

Here are few use cases that might be helpful.

USE CASE: Close all child entities on closing parent

Please find below an example of how to implement moving child entities to the final state if the parent entity is moved to the final state.

Check out how it works in the video below:

USE CASE: Automatically synchronize fields

You may configure entity fields synchronization in case of relation change. An example below shows how to make the Product Area of a Task the same as the Product Area of a User Story when Product Area of User Story changes.

You have to create two rules to maintain fields integrity:

1. Auto-update product area of tasks when product area of a story is changed

2. Auto-update product area of a task when it is linked to a story

USE CASE: Set completion date when a task is done

An example below shows how to set the completion date of a task when it is moved to the final state.

USE CASE: Auto-assign task on the creator

You can also write code to execute complex actions. An example below shows how to assign the task's creator to the task automatically.

The code fragment for the rule can be found below.

const fibery = context.getService('fibery'); 
for (const entity of args.currentEntities) {
const entityExtended = await fibery.getEntityById(entity.type, entity.id, ["Created by"]);
await fibery.assignUser(entity.type, entity.id, entityExtended["Created by"].id);
}
Did this answer your question?