Skip to main content
Version: 1.22.3

Record Extended Model

The Record Extended Model (REM) allows you to extend a set of table colums. The table structure of REM repeats the table structure with tables and columns. Instead of columns, REM uses Attributes (sys_re_attribute). You can connect REM attributes with a table within the Model (sys_re_model). You can also create attribute collections as universal sets of attributes that can be used in several models at the same time.

Use the Record Extended Model (REM) menu category to access the tables related to REM.

REM concept

Every table has its own data model specified by the business logic. The data model is represented by the column set. This data model can be extended with child tables containing the same column set as the parent one, and individual attributes inaccessible from the parent table. For example, the diagram below shows that all column of the User table are inherited by the Employee table:

Attributes extension circuit diagram

When few child tables are available, and the column overlap is high, this data model works fine. But when the number of child tables increases, and the column overlap decreases, the management of this data model becomes a challenge. The data model with a large and complicated table inheritance structure has some disadvantages:

  • It requires more space for record storage.
  • The script execution takes longer.
  • It is difficult to configure the functionality related to the specific table, such as data import, layout setting, and other.

The Template Service Catalog is an example of such a table. It consists of a parent table for the catalog and a table record of each request template with specific attributes.

The Record Extended Model (REM) concept addresses the issue described above. The extension concept can be applied to a specific table record, by assigning additional attributes to it.

When a record extension model is applied to a record, it means that an auxiliary record set is created for this record containing information about specific attribute values. Therefore, the record has attributes inherited from a table, and in addition, it has attributes sourced from the extension model.

Configure an extension model

To configure your extension model, you need to:

  1. Create an extension model.
  2. Create attributes and link them to the model.
  3. (optional) Configure the attribute collection.
  4. (optional) Configure a model client script.

In the diagram below, you can see the difference between models and collections. Models are created with a specific attribute set that can only be used in this model. Collections contain attributes that can be applied to different models.

caution

It is not recommended to create collections with many attributes. It is better to create several collections with one attribute. This approach provides flexibility in model configuration.

Create a model


To create a model, complete the steps below:

  1. Navigate to Record Extended Model (REM) → Models.
  2. Click New and fill in the fields.
  3. Click Save or Save and exit to apply the changes.

Record extended model form fields

FieldMandatoryDescription
TitleYSpecify the model title in any language.
TableYReference to the table affected by the model.
Note that after the model is saved the Table field becomes read-only.
DescriptionNAdd a description for the model.
After insert scriptNSpecify a script that should be executed after a record is created. Develop it using JavaScript extended by the SimpleOne SimpleRecord Server-Side methods.
ActiveNSelect the checkbox to activate the model.
IconNAdd an icon to identify the model.

Related Lists:

  • Attributes – a list of the attributes linked to this model.
  • Model Form Elements – a list of the form elements linked to this model.
  • Used Collections – a list of applied collections.
  • Model Client Scripts – a list of the model client scripts linked to this model.
caution
  • Do not create or add an attribute to a model if an attribute with the same name already exists in this model.
  • Do not rename an existing attribute if there is an attribute in the model with the name you need to enter.

Configure an attribute


In SimpleOne, you can create attribute mapping for models and collections. Data mapping is the process of connecting a data field from one table to a data field in another table. It reduces the potential for errors, helps standardize your data, and makes it easier to understand your data because it establishes direct relationships among your data across multiple tables at once.

To create an attribute, complete the steps below:

  1. Navigate to Record Extended Model (REM) → Attributes.
  2. Click New and fill in the fields.
  3. Click Save or Save and exit to apply the changes.

Attribute form fields

FieldMandatoryDescription
ContainerYSpecify a previously created model.
Attribute typeYSpecify the attribute type.
TitleYSpecify the attribute title. You can use Latin, Cyrillic letters, [0..9] numbers, and the underscore symbol ( _ ). The Title field can be translated to other languages.
Attribute nameYAttribute system name. This field is populated automatically. Latin letters, [0..9] numbers, and the underscore symbol ( _ ) are allowed.
The field is read-only after the record is saved.
Map to columnNSpecify the target field to map the attribute value before the record is inserted (including business rules of the before type). This option allows you to quickly transfer attribute values to fields. You can select columns of the table defined in the model record and columns of its child tables.
CommentsNAdd some comments to describe the attribute.
ActiveNSelect the checkbox to activate the attribute.
Read onlyNSelect the checkbox to make the field added with this attribute read-only.
MandatoryNSelect the checkbox to make the field added with this attribute mandatory.

Configure an attribute collection


Attribute collections are implemented to use Many-to-Many Relationships, so they allow you to reuse the same attributes across models instead of adding them separately to each model.

caution

It is not recommended to create collections with many attributes. It is better to create several collections with one attribute. This approach provides flexibility in model configuration.

To use it, complete the following steps:

  1. Create a collection record as described below.
  2. Fill it with previously created attributes or create new ones using the Attributes related list.
  3. Relate this collection with previously created models using the Used in Models related list.

After that, all the attributes contained in this collection are used by all models this collection relates to.

note
  • If you need to use attribute mapping in a collection, you need to specify a target table in the Table field of a collection. Otherwise, leave the Table field empty.
  • Collections with the populated Table field can only be added to models with the same table specified, or to models of its child tables.

To create a collection, complete the steps below:

  1. Navigate to Record Extended Model (REM) → Collection.
  2. Click New and fill in the fields.
  3. Click Save or Save and exit to apply the changes.

Collection form fields

FieldMandatoryDescription
TitleYSpecify the collection title.
ActiveNSelect the checkbox to activate the collection.
TableNSpecify the table to which the collection is related.

Related Lists:

  • Attributes – create an attribute related to this collection or select an existing one from the table.
  • Form Elements – create a form element related to this collection or select an existing one from the table.
  • Used in Models – create a model related to this collection or select an existing one from the table.
  • Client Scripts – create a model client script related to this collection or select an existing one from the table.
caution
  • Do not rename an existing attribute in the collection if there is an attribute in the model or in the collection linked to the model with the name you want to enter.
  • The same collection and model cannot be linked to each other more than once.
  • A model and a collection that have at least one of the same name attribute matching the model attribute cannot be bound between each other.

Configure a model client script


To create a record extended model client script, complete the steps below:

  1. Navigate to Record Extended Model (REM) → Model Client Scripts.
  2. Click New and fill in the fields.
  3. Click Save or Save and exit to apply the changes.

Model Client Script form fields

FieldMandatoryDescription
NameYDefine the client script name.
ContainerYReference to the model or collection.
TypeYSpecify the script type. Available options:
  • onLoad – the script starts when the system displays the form for the first time before users enter data. Generally, onLoad scripts perform manipulations on the client side with the current form or default record values set.
  • onChange – the script starts when the specified field on the form has been changed.
  • onSubmit – the client-side script can cancel form submission by returning false.
AttributeYSpecify a previously created model attribute. This field is mandatory when the onChange script type is selected.
DescriptionNAdd a description of the client script.
ActiveNSelect the checkbox to activate the script.
OrderNSpecify the client script execution order. Scripts are executed in ascending order.
ScriptNSpecify the client script. Use the methods of the SimpleForm class in the script.

If the model is displayed using the <rem> SimpleTag and refers to the same table, then the s_form object will match the parent form that uses the widget.

If on the page with a record form for one table there is an RE model of a record of another table, which is added to the form using a widget with the SimpleTag <rem>, or an RE model is displayed using the <remform> tag, the model client script cannot directly access the main record form through an s_form variable. In this case, there are two independent form objects on the page. To operate the main record form, use the construction s_widgets.getForm('formName'), where formName is the name of the view.

Configure model or collection form elements


You can arrange the fields of your model or collection attributes in a particular order and position, as you can do with the form layouts.

note

You can configure the position of the collection from the Model Form Elements related list of the Model form. But to configure the position of the attributes withing the collection, go to the Model Form Elements related list of the Collection form.

Group attributes by common features and give them a title. In the screenshot below, custom model attributes are divided into two columns:

tip

If you need to define a title for a group of attributes organized in one block, use the Begin element.

The title will appear on the relevant page of the Self-Service Portal.

To change the order of the displayed attributes, perform the following steps:

  1. Navigate to Record Extended Model (REM) → Models or Record Extended Model (REM) → Collections, depending on what you need to configure.
  2. Open the model or collection you need.
  3. In the Related Lists area, select the Model Form Elements tab.
  4. Arrange the attributes by changing the value in the Position field. The attributes are displayed on the form in the ascending order.
tip

Use the inline editing: double-click the cell in the Position column, enter the value, and press Enter to save the changes.

To add new elements to the model or collection layout (such as splits), perform the following steps:

  1. Navigate to Record Extended Model (REM) → Models or Record Extended Model (REM) → Collections, depending on what you need to configure.
  2. Open the model or collection you need.
  3. Click New and fill in the fields.
  4. Click Save or Save and exit to apply the changes.

Model Form Element form fields

FieldMandatoryDescription
ContainerYSpecify a previously created model or collection. If the element is created from the related list, the field is populated automatically.
PositionYDefine the order of the element on the form. The elements are displayed on the form in the ascending order.
Block elementYSpecify the type of the element. Available options:
  • Begin – use this element to define the beginning of the block of fields. You can define the name of a group in the Block title field that appears when you select this type.
  • Split – use this element to divide the fields into columns.
  • End – use this element to define the end of the block of fields.
Block titleNSpecify the title of the group of fields. The title is displayed above the attributes group on the relevant page of the Self-Service Portal.
This field appears when the Block element value is Begin.