Skip to main content
Version: 10

Use virtual objects in Creatio tools

Level: advanced
note

This functionality is available for Creatio 10.2 and later.

You can select a virtual object in the Application Hub, Freedom UI Designer, Dashboard Designer, Freedom UI Mobile Designer, and Process Designer the same way as a regular object. When you select a virtual object, the tool shows a warning, for example, "The selected object is virtual. Make sure it supports all operations this page needs, or data may not display or save correctly." The warning text differs between the tools. Creatio shows the warning for every virtual object since the tool cannot check which operations the code of the object supports. Learn more about virtual objects: Virtual objects basics.

Each tool requires a specific set of operations from a virtual object. Find the tool you use and make sure that the virtual object supports the operations that the tool requires. To implement the operations, follow the instructions: Implement a virtual object.

Virtual object operations​

A virtual object has no database table, so Creatio passes every operation to the code that the developer writes for the object. Whether a tool works correctly depends on the operations that the code supports. The following rules explain most issues with virtual objects:

  • The query executor applies the whole query. The query includes the columns, filters, sort order, number of records to return and skip, or the total to calculate. Creatio does not filter or sort the records that the query executor returns and does not split the records into batches. Users see exactly these records.
  • Changing and deleting a record starts with a read. Before changing or deleting a record, Creatio reads the record by ID using the query executor and processes every record that the query executor returns. If the query executor cannot find the record, Creatio has no record to save or delete. If the query executor ignores the condition on the ID and returns all records, saving a single record on a page overwrites all records, and deleting a single record deletes all records.
  • A missing event listener method is not an error. If the event listener has no OnInserting(), OnUpdating(), or OnDeleting() method, Creatio reports that the record is saved or deleted, but the data source does not change.

Each Creatio tool requires a specific set of operations. The following table lists the operations of a virtual object and how to implement each operation.

Operation

Description

Implementation

Filtering records

Return only the records that match the query conditions.

Query executor

Sorting records

Return the records in the requested order.

Query executor

Loading records in batches

Return a limited number of records and skip the records of the previous batches.

Query executor

Calculating totals

Return a single value instead of records: count, sum, average, minimum, or maximum.

Query executor

Reading records by ID

Return the records that have the specified ID or IDs. Saving and deleting records requires this operation.

Query executor

Adding records

Add a record to the data source.

OnInserting() method of the event listener

Changing records

Change a record in the data source.

OnUpdating() method of the event listener

Deleting records

Delete a record from the data source.

OnDeleting() method of the event listener

Operations required by Creatio tools​

Application Hub​

You can create an app for a virtual object using the Link to an existing object checkbox in the Advanced parameters block of the New application window. The app includes a list page and a form page and requires everything that the list and the form page require. Implement the operations listed in the table below to use a virtual object in the app.

Operation

Application Hub

Filtering records

+

Sorting records

+

Loading records in batches

+

Calculating totals

+

Reading records by ID

+

Adding records

+

Changing records

+

Deleting records

+

The generated pages include buttons for every operation. If the event listener has no method for an operation, for example, the OnDeleting() method, users click the button, see no error, and the record stays in place. Remove such buttons from the generated pages.

Freedom UI Designer​

You can select a virtual object in the Freedom UI Designer in the following cases:

  • When you add the virtual object to a page as an existing data source in the element library.
  • When you fill out the Object parameter in the setup area of a component, for example, the List, Gallery, or Calendar component.
  • When you fill out the Object parameter in the setup area of a widget, for example, a list widget, metric, or pivot table. For a metric, this includes the comparison value and the elements of the formula.

Select the operations to implement based on the page data source, components, and widgets listed in the table below.

Operation

Page data source

Components

Widgets

List and Gallery

Calendar

Next best offers

List widget

Metrics

Pivot tables

Filtering records

—

+

+

+

+

+

+

Sorting records

—

+

+

+

+

—

—

Loading records in batches

—

+

+

+

+

—

+

Calculating totals

—

+

—

—

+ (only for the counter of selected records)

+

—

Reading records by ID

+

—

—

—

—

—

—

Adding records

+

—

—

—

—

—

—

Changing records

+

—

—

—

—

—

—

Deleting records

+

—

—

—

—

—

—

Page data source​

If the data source of a form page is a virtual object, the page reads a single record and saves the record. Select the operations to implement based on the user actions listed in the table below. The table uses the "External invoice" (UsrExtInvoice code) virtual object as an example.

User action

Creatio actions

Required operations

Click New

Populates the fields with the default values from the column settings. Does not call the code of the object.

None

Save a new record

  1. Creates a record with the values of all fields.
  2. Calls the OnInserting() method of the event listener.

Adding records

Open an external invoice

Queries the record whose ID matches the ID of the opened record, with the columns of the page fields.

Reading records by ID

Change the Amount field and save the invoice

  1. Reads the record by ID with all columns of the object.
  2. Sets the changed fields.
  3. Calls the OnUpdating() method of the event listener.
  4. Reads the saved record by ID together with the current filters of the list of the same object that is open in the app.

Reading records by ID,
Changing records

Copy a record

  1. Reads the source record by ID.
  2. Saves the copy as a new record.

Reading records by ID,
Adding records

Delete a record on the page or in a list

  1. Reads the records to delete by a list of IDs using the query executor.
  2. Calls the OnDeleting() method of the event listener for each record.

Reading records by ID,
Deleting records

If an operation is missing, the following issues occur:

  • The OnInserting() or OnUpdating() method is missing. The page reports a successful save, but the change is lost after the page is reopened.
  • Reading records by ID is missing. The page opens empty or shows another record.
  • The OnDeleting() method is missing. The record disappears from the list and appears again after a refresh.

List and Gallery components, list widget​

The List and Gallery components and the list widget only read data. Every user action sends a new query to the query executor. Select the queries to support in the query executor based on the user actions listed in the table below. The table uses the "External invoice" (UsrExtInvoice code) virtual object that includes the "Name," "Amount," and "Owner" columns as an example. The "Owner" column is a "Lookup" type column that refers to contacts.

User action

Query content

Open the page

  • Columns: the columns of the list, the ID column, and the displayed value column of the object.
  • Sort order: the sort order of the list, if the list has a sort order.
  • RowCount property: "30."
  • SkipRowCount property: "0."

Scroll to the end of the loaded records

  • Columns and sort order: as in the query that opens the page.
  • RowCount property: "30."
  • SkipRowCount property: "30," then "60," and so on.

Click a column header

  • Sort order: by the selected column.
  • RowCount property: "30."
  • SkipRowCount property: "0."

Enter text in the search field

Filters: a group of conditions joined by the OR operator.

  • The "Name" column contains the text.
  • The "Amount" column equals the text if the text is a number.
  • The displayed value of the "Owner" column contains the text.

Depending on the "String columns filter" (StringColumnSearchComparisonType code) system setting, "Contains" can be "Starts with."

Set a quick filter

  • Filters for a "Lookup" type column: the "Owner" column equals any of the selected contacts.
  • Filters for a date column: "Between," "Greater than or equal to," "Less than or equal to," or "Is empty."

Select records in the list

  • Aggregation column: the number of records.
  • Filters: the current filters of the list.
  • RowCount property: "-1."

Learn more: Metrics.

Click Summaries on the list toolbar

  • Aggregation column: the function that you select for the list column, for example, "Sum" or "Average."
  • Filters: the current filters of the list.

Learn more: Metrics.

If an operation is missing, the following issues occur:

  • Displayed values of "Lookup" type columns are missing. The "Owner" column is empty.
  • Loading records in batches is missing. Scrolling loads the same 30 records again.
  • Sorting is missing. A click on a column header changes nothing.
  • Filtering is missing. The search and the quick filters change nothing, and users believe that the list is filtered.

Calendar component​

The Calendar component reads records in batches of 150 records sorted by the start date. The visible period comes from a Date quick filter that is connected to the calendar. Select the queries to support in the query executor based on the user actions listed in the table below.

User action

Query content

Open the calendar or change the visible period

  • Filters: date conditions "Between," "Greater than or equal to," "Less than or equal to," and "Is empty," joined by the AND and OR operators.
  • Sort order: by the start date column.
  • RowCount property: "150."
  • SkipRowCount property: "0," then "150," and so on.

If an operation is missing, the calendar shows records outside the selected period or shows only the first 150 records.

Next best offers component​

Select the queries to support in the query executor based on the user actions listed in the table below.

User action

Query content

Open the page that includes the component

  • Filters: by the record of the page that includes the component.
  • Sort order: descending, by the column that the component shows as the number tag.
  • RowCount property: "30."

Metrics​

A metric does not read records. A metric queries a single total that Creatio calculates for the records that match the filter of the metric. Select the queries to support in the query executor based on the metric parameters listed in the table below.

Metric parameter

Query content

The Function parameter is set to "Count"

  • Aggregation column: the number of distinct values of the Id column.
  • Filters: the filter of the metric.

The Function parameter is set to "Sum," "Average," "Minimum," or "Maximum"

  • Aggregation column: the function for the selected column.
  • Filters: the filter of the metric.

The Compare with another value parameter is enabled

  • A separate query.
  • Object, aggregation column, and filters: the object, function, and filter that you set up using the Set up comparison button.

The Function parameter is set to "Formula"

  • A separate query for each element of the formula.
  • Object, aggregation column, and filters: the object, function, and filter of the element.

The query has no sort order, and the RowCount and SkipRowCount properties are not set. The response is a single row that contains the value. If the page or quick filters filter the metric, the conditions are included in the same query.

If an operation is missing, the metric shows "0," shows an error, or shows a value that ignores the filter.

Pivot tables​

A pivot table does not query totals. A pivot table reads the records in batches and calculates the totals in the browser. Select the queries to support in the query executor based on the user actions listed in the table below.

User action

Query content

Open the page that includes the pivot table

  • Columns: the columns of the pivot table.
  • Filters: the filter of the pivot table.
  • RowCount and SkipRowCount properties: the batches of records until Creatio reads all records.

Group a date field by year, month, week, day, or hour

Columns: the parts of the date as separate calculated columns. Use such grouping only if the developer confirms that the query executor supports it.

If loading records in batches is missing, Creatio counts the same records multiple times and the totals are too high.

Dashboard Designer​

You can select a virtual object in the Dashboard Designer when you fill out the Object parameter in the setup area of a widget, for example, a list widget, metric, or pivot table. The widgets of a dashboard send the same queries as the widgets on a Freedom UI page. Select the operations to implement based on the widgets listed in the table below.

Operation

List widget

Metrics

Pivot tables

Filtering records

+

+

+

Sorting records

+

—

—

Loading records in batches

+

—

+

Calculating totals

+ (only for the counter of selected records)

+

—

Reading records by ID

—

—

—

Adding records

—

—

—

Changing records

—

—

—

Deleting records

—

—

—

Learn more about the queries of each widget: List and Gallery components, list widget, Metrics, Pivot tables.

Freedom UI Mobile Designer​

You can select a virtual object in the Freedom UI Mobile Designer when you fill out the Object parameter of the List component. The List component shows the records in Creatio Mobile and reads the records the same way as the List component in the Freedom UI Designer. Learn more: List and Gallery components, list widget. Select the operations to implement based on the component listed in the table below.

Operation

List component

Filtering records

+

Sorting records

+

Loading records in batches

+

Calculating totals

—

Reading records by ID

—

Adding records

—

Changing records

—

Deleting records

—

Process Designer​

You can select a virtual object in the Read data, Add data, Modify data, and Delete data process elements. Each process element shows the warning under the property that specifies the object, for example, Which object to read data from?, in the setup area. Select the operations to implement based on the process elements listed in the table below.

Operation

"Read data" process element

"Add data" process element

"Modify data" process element

"Delete data" process element

Read the first record in the selection

Read collection of records

Calculate function

Calculate the number of records

Filtering records

+

+

+

+

—

+

+

Sorting records

+

+

—

—

—

—

—

Loading records in batches

—

+

—

—

—

+

+

Calculating totals

—

—

+

+

—

—

—

Reading records by ID

—

—

—

—

—

+

+

Adding records

—

—

—

—

+

—

—

Changing records

—

—

—

—

—

+

—

Deleting records

—

—

—

—

—

—

+

A business process has no user who notices an empty list. If the code of the object does not support an operation that a process element requires, the process element stops the business process with an error or processes the wrong records.

Read data process element​

The operations that the Read data process element requires depend on the value of the Which data read mode to use? property in the setup area. Select the queries to support in the query executor based on the property values listed in the table below.

Value of the "Which data read mode to use?" property

Query content

Issues if an operation is missing

Read the first record in the selection

  • Filters: the How to filter records? property in the setup area.
  • Sort order: the How to sort records? property in the setup area.
  • RowCount property: "1."
  • Without filters, the business process receives a record that does not match the condition.
  • Without sorting, the business process receives an arbitrary record instead of the first record.

Read collection of records

  • Filters: the How to filter records? property in the setup area.
  • Sort order: the How to sort records? property in the setup area.
  • RowCount property: the number of records that the element specifies, if set.

The collection includes records that do not match the filter or misses records.

Calculate function

  • Aggregation column: "Count," "Sum," "Average," "Minimum," or "Maximum."
  • Filters: the How to filter records? property in the setup area.

The process element fails, or the result is "0."

Calculate the number of records

  • Aggregation column: the number of records.
  • Filters: the How to filter records? property in the setup area.

The process element fails, or the result is "0."

Add data process element​

The operations that the Add data process element requires depend on the What is the data adding mode? property in the setup area. Select the operations to implement based on the property values listed in the table below.

Value of the "What is the data adding mode?" property

Creatio actions

Required operations

Add one record

  1. Creates a record.
  2. Populates the default column values and the values from the Which column values to set? property in the setup area.
  3. Saves the record and calls the OnInserting() method of the event listener.

Adding records

Add selection

  1. Reads the records of the object that the Selection from an object property in the setup area specifies and that match the filter. If the object is virtual, reads the records in batches and by a list of IDs using the query executor of the object.
  2. Adds a record for each read record and calls the OnInserting() method of the event listener of the target object.

Filtering records,
Loading records in batches,
Reading records by ID,
Adding records

Modify data process element​

The Modify data process element changes every record that matches the Modify all records that match condition property in the setup area. The process element changes the records in the following stages: finds the records, reads the found records in full, and saves each record. Select the operations to implement based on the stages listed in the table below.

Stage

Creatio actions

Required operations

Find the records

Queries the records that match the condition using the query executor in batches of 10,000 records. If the query executor ignores a filter that it does not support, the query returns every record of the object, and the process element changes all records. The query executor must reject such a query with an error.

Filtering records,
Loading records in batches

Read the found records in full

Reads the found records again with all columns, 100 records at a time, by a list of IDs.

Reading records by ID

Save each record

Sets the new values in each record, saves the record, and calls the OnUpdating() method of the event listener for every record.

Changing records

Delete data process element​

The Delete data process element deletes every record that matches the Delete all records that match condition property in the setup area. The process element deletes the records in the following stages: finds the records, reads the found records, and deletes each record. Select the operations to implement based on the stages listed in the table below.

Stage

Creatio actions

Required operations

Find the records

Queries the records that match the condition using the query executor in batches. If the query executor ignores a filter that it does not support, the query returns every record of the object, and the process element deletes all records. The query executor must reject such a query with an error.

Filtering records,
Loading records in batches

Read the found records

Reads the found records by a list of IDs.

Reading records by ID

Delete each record

Deletes the records one by one and calls the OnDeleting() method of the event listener for every record.

Deleting records

Process elements that do not support virtual objects​

You cannot select a virtual object in the following process elements and properties of the Process Designer:

  • Auto-generated page process element.
  • Change access rights process element.
  • Find and merge duplicates process element.
  • Signals, for example, the start signal of the Event sub-process process element and the Throw signal process element. Creatio does not start a business process by a signal of a virtual object.
  • Process parameters.

See also​

Virtual objects basics

Implement a virtual object