Advanced topic: Entity instantiation

A quick explanation of how new instances of entities can be created during 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 of this and e.g. return this from a Function like this: new Person()

A few examples:

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

alternatively:

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:

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

Last updated