Skip to content
v2.7 (latest)
A quick explanation of how new instances of entities can be created during execution.

Entity instantiation ​

This guide explains how to create new instances of entities during ruleset execution.

Anywhere in code (functions, rules, calculated properties), you can create new entities on the fly. For instance, when you have an Entity named 'Person', you can create an instance like this: new Person()

A few examples:

js
// Inside a Function
let person = new Person();
person.FirstName = "John";
person.LastName = "Doe"
return person;

alternatively:

js
let person = new Person({ FirstName: "John", LastName: "Doe"});
return person;

Calculated properties work as expected. Assuming Person has a calculated property named 'FullName' that combines the first and last name properties:

js
let person = new Person({ FirstName: "John", LastName: "Doe"});
return person.FullName; // "John Doe"