Rules

Rules define the logic of the Action type that transform the parameters into ontology edits or other effects. There are two main types of rules: ones that edit the ontology, and ones that trigger another effect in Foundry.

Ontology Rules

An Ontology rule changes specific elements of the Ontology. They can create, modify, or delete objects and links of exiting types. To create or delete one-to-many or one-to-one links, object Rules need to be used and the foreign key property on the object needs to be modified.

  1. Create object: Can be used to create an object of a predefined type. The primary key of the object type is a required property which has to be filled. Additional properties can be added optionally.
  2. Modify object(s): Can be used to modify an existing object whose primary key is derived from object reference parameters. This cannot reference an object created as a part of the current Action.
  3. Delete object(s): Can be used to delete an existing object whose primary key is derived from object reference parameters. This cannot reference an object created as a part of the current Action.
  4. Create link(s): Can be used to create a many-to-many link between objects that are passed via object reference parameters. For foreign key links, one has to use Modify object rule to explicitly modify the foreign key property.
  5. Delete link: Can be used to delete a many-to-many link between objects that are passed via object reference parameters. For foreign key links, one has to use Modify object rule to explicitly modify the foreign key property.
  6. Function Rule: Can be used to reference an ontology edit function whose inputs are derived from parameters of the Action. When this rule is present, no other rule may be configured since Function code alone is capable of handling everything that other rules can do. Read more about Function Action types.

Values and parameters

When creating or modifying links and objects, the Rules require additional values for their operation. When modifying an object, the rules also define which properties are modified. Each property in return is mapped to a value provided by one of multiple options (Rules on links can only take object reference parameters):

  • From parameter: An existing parameter of the same type as the property. By default, every new property being added to the rule will automatically create a parameter with the same name and will be mapped to take the value of this parameter.
  • Object parameter property: A property of an existing object reference parameter. The property type of the object parameter needs to match the property type it is mapped to.
  • Static value: A static value that only exists in the Rules part of the Action type. This value is cannot be changed when interacting with the Action in Workshop, Slate, or Object views.
  • Current User/Time: String and timestamp properties can also take on contextual values in the form of the Actions current user or the time of submission. Just like the Static value, these values cannot be interacted with when submitting the Action and cannot be used in other parts of the Action type.

You can also create objects and linked many-to-many at the same time. While just creating a many-to-many link requires objects on both sides of the link to exist prior, you can create both entities via one Action type. Start by configuring a Create object Rule with an object type that has a many-to-many link. Then click the Add link button below Add property to select the link type and configure the links.

In order to create a one-to-many or one-to-one link type, simply edit the foreign key on the object.

Invalid combinations

Action types can include combinations of ontology rules. When multiple rules are defined, the Actions backend compiles rules to generate a single edit per object (e.g., Add object, Modify object(s), or Delete object(s)). For example, if the result of one rule updates a property to "A", but another rule in the same Action type updates the same object's property to "B", the resulting edit would just update the property to "B". The order of rules affects the final object edit. As a result, the following combinations of object edits are not supported:

  • Objects cannot be deleted before they are added or modified.
  • Objects cannot be modified before they are added.
  • Objects cannot be created twice in one form submission.

Other rules

There are two types of rules that trigger a side effect:

  • Notification Rules can be used to send a notification about the Action. Parameters may be used to customize the content of the notification and the recipients. End users may adjust their preferences to receive notifications via in-platform push notification, email, or both. Notifications are sent once all Action edits have been applied, however the content of the notification will be generated based on the state of the Ontology before edits are applied.
  • Webhooks enable an Action to make a request to an external system when the Action is applied. Action parameters can be passed into the Webhook, which can in turn pass parameters through to the external request. Webhooks may be configured to run before or after edits are applied.