Skip to main content
Version: 8.1

Auto-apply business rules to records that are added by a custom request handler

Level: beginner
note

This functionality is available for Creatio 8.1.4 and later.

Since version 8.1.4, Creatio lets you execute business rules whenever custom request handler adds a record to a collection. For example, use the functionality if you need to populate a collection of records, apply business rules for each record and output the result in a section list.

To auto-apply business rules to collection records that a custom request handler adds:

  1. Go to the handlers schema section.
  2. Implement a custom request handler if needed.
  3. Add a createItem() method that creates a new record, for example, when you click the Add button.
  4. Set the businessRulesActive property to true. The property auto-applies business rules to a new collection record.

View the example that implements a custom usr.AddRecordRequest request handler of the Freedom UI page schema below. The handler is bound to the clicked button event and adds the “John Smith” record to the section list. If the businessRulesActive property is set to true, Creatio automatically applies business rules to a new collection record. Otherwise, Creatio does not apply business rules to a new collection record until the record is selected in the section list.

handlers: /**SCHEMA_HANDLERS*/[{
/* The custom implementation of the custom request handler. */
request: "usr.AddRecordRequest",
handler: async (request, next) => {
/* The section list collection that the Freedom UI section page displays. */
const collection = await request.$context.Items;
/* Add a new record of the section list collection. */
await collection.createItem({
/* Set the “Name” field to “John Smith.” */
initialModelValues: { Name: 'John Smith'}
});
return next?.handle(request);
}
}]/**SCHEMA_HANDLERS*/,

See also

Set up List components (user documentation)