Record Extended Model allows you to extend a set of table attributes. The table structure of REM repeats the dictionary structure with tables and columns. Instead of columns, Attributes (sys_re_attribute) are used in REM. You can connect REM attributes with a table within the Model (sys_re_model). Besides, you can create attribute collections as universal sets of attributes that can be used in several models at the same time.
You can access to dictionaries related to REM through the Record Extended Model (REM) menu category.
REM concept
What is REM?
To answer this question, we need to provide some theory first.
Thesis 1
In SimpleOne, you can handle with data which is represented as records in tables that have a specified attribute set. Records appear in tables and they have these attribute values given.Thesis 2
Every table has its own data model stipulated specified by the business-logic. The data model is represented by the column set (their amount, types, links with another system objects, and so on). This data model can be extended with child table with the same attribute set as a the parent one, and an individual attributes inaccessible from the parent table, as an addition. For example, the diagram below shows that all attributes of the User table are inherited by the Employee table:
Attributes extension circuit diagram
Image Removed
Conclusion
To manage the commonalous entities (like ITSM Tasks), we can create a table with appropriate column set and extend from it for Incidents, Change Requests, Problems, and so on, creating respective tables that inherit attributes (columns) from a parent one and besides have their own attributes. For example, attribute overlap in there may be 70%, and unique attributes will be 30% of the total.
Image Added
When there are not In this case, this model works fine (when we do not have many child tables, and the attribute overlap is high), this data model works fine. But when the child table number increases, and the attribute overlap decreases, the management of this data model becomes a challenge. Data model with big and complicated table inheritance structure has some disadvantages:
- It is required to allocate more space for record storage.
- Scripts are executed slower.
- It is getting harder to configure the functionality related to the specified dictionary, such as data import, layout setting and so one, etc.
A Request Catalog can be taken as an example of such a table (: a parent table for the catalog and a record in the table for every each request template with specific attributes).
To deal with this issue, another Record Extended Model concept has been created and implemented - Record Extended Model.
REM Concept
In this concept, extension . Extension concept can be applied for to a specified table record, giving some featured additional attributes to it.Physically, extension model are stored as records of the Models (sys_re_models) table, and they intended to collect specific attributes extending records. Attributes are stored as records of the Attributes (sys_re_attribute) table (extending the Columns (sys_db_column) table).
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. So the record has attributes inherited from a table, and in addition, it has attributes sourced from the extension model.
Configuring extension models
Generally, to configure your extension model, you need to:
- Create an extension model.
- Create attributes ( and link it them to the model).
- (optional) Configure an the attribute collection.
- (optional) Configure RE client script if needed.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.
Note |
---|
It is not recommended to create collections with many attributes. It is better to create one collection with one attribute. |
Image Added
Creating models
To create a model, please complete the steps below:
- Navigate to Record Extended Model → Model (REM) → Models.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply the changes.
Record extended model Extended Model form fields
Field | Mandatory | Description |
---|
Name | Y | The model name. |
Title | Y | The model title. Can be specified in a language other than English. |
Table | Y | |
a the table affected by the model. Note |
---|
Please note that after saving you cannot specify |
|
a read-only table. To use such a table, please turn off this attribute first.The Type model description. |
After insert script | N | Specify a script that should be executed after a record is created. Develop it using JavaScript extended by the SimpleOne SimpleRecord Server-Side |
and SimpleForm this checkbox the checkbox to make the model active or inactive. |
Icon | N |
Reduced the model identification. |
Related |
---|
listsAttribute the RE attributes the attributes linked to this model. |
Model |
client script RE client scripts form element linked to this model. |
Used Collections | List of applied collections |
Model |
form elementClient Scripts | List of the |
RE form element client scripts linked to this model. |
Note |
---|
- 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 want to enter.
|
Configuring attributes
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 between your data across multiple tables at once.
To create an attribute, please complete the steps below:
- Navigate to Record Extended Model → Model (REM) → Attributes.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply the changes.
Attribute form fields
Field | Mandatory | Description |
---|
Container | Y | Reference to a previously created model. |
Column a column typethe attribute type. |
Title | Y |
An Specify the attribute title. |
Can be specified in a language other than English. You can use Latin, Cyrillic letters, |
[0..9] numbers and the underscore symbol ( _ ) |
are allowedColumn A column Attribute system name. This field is populated automatically. |
[0..9] numbers and the underscore symbol ( _ ) are allowed. |
Map to Column | N | |
a the target field to map the attribute value |
after createdinserted (including business rules of the before type). This option allows |
nimble transferring of the you to quickly transfer attribute values to fields. The field is of the Reference type and has a reference qualifier, which allows for choosing columns of table defined in the model record and columns of its child tables. |
Please note that if If the target field is mandatory, |
|
then is will be saved before it is processed by the server validation engine. Also, if the target field is mandatory, it should not be |
|
not displayed on the form, otherwise the client validation engine may hamper the record saving. |
Note |
---|
Mapping via the Map to Column field is available only if the column type of the attribute is equal to the target column type. |
The following message appears if there is no target column in the table: Panel |
---|
Attribute "{attribute_name}" mapping error, reference column not found in the table .
|
|
Comments | N | Put |
here some comments here describing your attribute. |
Active | N | Select |
this the checkbox to make the attribute active or inactive. |
Read Only | N | Select |
this the checkbox to make the field |
adding by added with this attribute read-only. |
Mandatory | N | Select |
this the checkbox to make the field |
adding by added with this attribute mandatory. |
Full text search | N | Select this checkbox to make the field adding by this attribute indexable. |
Display by Ref | N | Select this checkbox to make the field adding by this attribute display its displayValue instead of a value (see the Display by ref description for more information) |
Unique | N | Select this checkbox to make the field adding by this attribute unique. |
Type Specification tab |
---|
Max Length | N | (For the columns that have a String or Text type) Specify a maximum value length for this column. The value length cannot exceed allowable length for the specified data typeType Specification tab |
---|
Dependent on Column | Y | Specify a column with reference to the Table (sys_db_table). The field appears when one of the following options is selected in the Attribute Type field: - Field Name
- Conditions
- Template.
|
Maximum Length | N | Specify a maximum value length for the attribute value. The value length cannot exceed the allowable length for the specified data type. The field appears when one of the following options is selected in the Attribute Type field: - String
- Text
- URL
- Password
- Script
- Journal Input
- HTML
- Encrypted Password
- Translated Text
- Record Class.
|
Choice Table | N | Reference to a table. The field appears when the Choice option is selected in the Attribute Type field. |
Choice Field | Y | Reference to a particular column of the table specified in the Choice Table field. The field appears when the Choice Table field is populated. |
Choice Type | Y | Define whether the None option is applicable for the field. Available options: - Dropdown with --None--
- Dropdown without --None-- (specify a default value).
If the Dropdown without --None-- is chosen, the Default value field becomes mandatory. The field appears when the Choice option is selected in the Attribute Type field. |
Extra Attributes | N | Specify additional configurations for the field. For example, enter the text below to apply radio buttons style to the choice field:
The field appears when one of the following options is selected in the Attribute Type field: |
Reference | Y | Specify a table with the values you need. The field appears when the List or Reference option is selected in the Attribute Type field. |
On Delete | N | Select the action to take when the referenced recordis deleted. Available options: - No action – no actions will be taken.
- Set NULL – the reference to this record will be deleted from the field (the value will be equal to 'null').
- Cascade – the record containing reference to it will be deleted as well.
- Restrict – deletion the referenced record is forbidden.
- Set default value– the reference to it will be changed to the default value defined at the Default Value tab.
The field appears when the Reference option is selected in the Attribute Type field. |
Default Value tab |
---|
Default Value | N | Specify |
a the default value that will be populated to the field when creating a new record. This field may be specified by a |
Javascript JavaScript scenario as well. |
Use Dynamic Default | N | Select |
this want to want to generate the default value dynamically. |
Dynamic Default | Y | This field only appears |
only the attribute is set to TRUE checkbox is selected. Select the script from the Dynamic Default Values (sys_default_value_dynamic) dictionary, so its execution result will be automatically calculated and entered into this field; this value will be the default value for the column specified. - The script must be
|
preliminary - preliminarily created in the Dynamic Default Values (sys_default_value_dynamic) dictionary; otherwise, you will not be
|
not - able to choose it.
- You can only choose
|
only Active attribute is equal to Yes)- Active checkbox is selected).
|
Reference Qualifier |
---|
Reference Qualifier Type | N | Specify the type of the reference qualifier. Available options: The field appears when the List, Reference or Field Name option is selected in the Attribute Type field. |
Reference Qualifier Condition | N | Configure filters using the Condition Builder. The field appears when the Simple option is selected in the Reference Qualifier Type field. |
Dynamic Reference Qualifier | N | Select the dynamic reference qualifier from the list. The field appears when the Dynamic option is selected in the Reference Qualifier Type field. |
Reference Qualifier Fixed | N | Select the checkbox to fix filters in breadcrumbs. This functionality will block using the Condition Builder functionality. The field appears when one of the following options is selected in the Attribute Type field: |
Configuring attribute collections
Attribute collections are implemented for using to user Many-to-Many Relationships so , so they allow reusing you to reuse the same attributes in various accross models instead of adding them in every separately to each model where necessary.
A simplified usage Simplified concept of use is:
- Create a collection record as described below.
- Fill it with previously created attributes or create new ones using the Attributes related list.
- 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 related withcollection relates to.
Info |
---|
- If you want to use attribute mapping in a collection, you need to specify a 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 child tables.
|
To create a collection, please complete the steps below:
- Navigate to Record Extended Model → Model (REM) → Collections.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply the changes.
Collection form fieldfields
Field | Mandatory | Description |
---|
Title | Y | Specify |
a the collection title. |
Active | N | Select |
this checkbox the checkbox to make the collection active or inactive. |
Table | N | Specify the table to which the collection is related. |
Related |
---|
listsOn In this related list, you can create a new attribute related to this collection or select an existing one from the dictionary. |
Form Elements |
On you you can create a new form element related to this collection or select an existing one from the dictionary. |
Used in Model |
On you you can create a new model related to this collection or select an existing one from the dictionary. |
Client Scripts |
On you you can create a new model client script related to this collection or select an existing one from the dictionary. |
Note |
---|
- 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.
- Model and collection that have at least one eponymous attribute matching the model attribute cannot be bound between each other.
|
Configuring model client scripts
To create a record extended model client script, please complete the steps below:
- Navigate to Record Extended Model → Model (REM) → Model Client Scripts.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Model client script Client Script form fields
Field | Mandatory | Description |
---|
Name | Y |
Client Define the client script name. |
Table a table affected by a model.RE model | Y | Reference to a previously created modelthe model or collection. |
Type | Y |
The Specify the script type. Available options: |
it - the script starts when the system displays the form for the first time before users
|
will - enter data. Generally, onLoad
|
scripts - scripts perform manipulations on the client
|
-- side with the current form or
|
set ; it - the script starts when the specified field
|
in is ; this - the client-side script can cancel form
|
submitting RE attribute | false;onCellEdit - this client-side script starts at the moment when some cell is to edit.- oldvalue - the old value for the cell that was edited;
- newValue - the new value for the cell that was edited;
- table - the table name of the cell being edited (for example, sys_db_table);
- sysId - the ID of the record relevant to the cell being edited;
- callback - if this variable is equated to FALSE, then subsequent scripts will not run; otherwise, they will execute.
N | Reference to a previously created model attribute. This field is mandatory when the onChange script type is chosen. |
Description | N | Client script description. |
Active | N | Select |
this checkbox the checkbox to make the script active or inactive. |
Order | N |
Client Specify client script execution order. Scripts are executed in ascending order. |
Script | N | Specify |
a Develop it using JavaScript extended by SimpleOne SimpleForm class.How to use record extensions
For a full record extension functionality using, some additional actions are to be fulfilled. Below, a simplified implementation procedure can be found.
- Create an extension model as described above.
- Create necessary attributes and bind them to the model.
- You can create attributes out of the your created model using the appropriate related list.
- Create a new widget using <rem> or <remform> SimpleTags (based on the widget planned location, a record form or a portal page).
- Add newly created widget to a record form using the Form Layout functionality (or add it to the appropriate portal page using the portal pages configuring functionality).
Example of usage
For example, you need to extend your Task table with some attributes allowing to handle some daily duties. To perform this, follow the procedure described above:
Create an extension model for this table.
Image Removed
Create attributes (wonder which fields could be created on this record form within this task). There should be a single attribute for every single for field.
Image Removed
Create a form widget as described below and save it:
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
title | Widget Template |
---|
|
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" /> |
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | Widget Client Script |
---|
linenumbers | true |
---|
|
(() => {
window.s_widget_custom = window.s_widget_custom || {};
const parameter = new URLSearchParams(window.location.search).get('model_id');
s_widget.setFieldValue('model_id', parameter);
s_widget.setFieldValue('table_name', window.s_form.getTableName());
s_widget.setFieldValue('record_id', window.s_form.getUniqueValue());
})(); |
Add this widget to the record form view using the Form Layout functionality:
Image Removed
Navigate to a record form using the URL looking like: https://instance.example.com/record/task?model_id=XXXXXXXXXXXXXXXXX
Info |
---|
In this URL. you need to substitute the X's with the model ID you are using in this case. To know it, please complete the steps below: - Navigate to Record Extended Model → Models.
- The model ID can be found in the ID column of the list displayed (if this column is absent, then let it display using the List layout functionality).
Without using this URL addition, a non-extended form is displayed. |
You can arrange the fields of your model attributes in a particular order and position, as you can do with form layouts. Group attributes by common features and give them a title. In the screenshot below, custom model attributes are divided into two columns:
Image Added
Tip |
---|
If you want 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:
- Navigate to Record Extended Model (REM) → Models.
- Open the model you need.
- Scroll down to the Related Lists area and open the Model Form Elements tab.
Arrange the attributes by changing the value in the Position field.
Tip |
---|
Use inline editing: double-click on the cell in the Position column, enter the value and press Enter to save changes. Image Added
|
To configure a model layout, perform the following steps: Anchor |
---|
| add split elements |
---|
| add split elements |
---|
|
- Navigate to Record Extended Model (REM) → Models.
- Open the model you need.
- Scroll down to the Related Lists area and open the Model Form Elements tab.
- Click New and fill in the fields.
- Click Save or Save and Exit to add the element.
Model Form Element form fields
Field | Mandatory | Description |
---|
Container | Y | Reference to a previously created model. If the element is created from the related list, the field is populated automatically. |
Position | Y | Define the order in which the element will be displayed on a form. |
Block Element | Y | Specify the type of the splitter. Available options: - Begin – use this element to define the beginning of block of fields. You can define the name of a group in it. When selected, the Block Title field is displayed.
- Split – use this element to divide the field into columns.
- End – use this element to define the end of the block of fields.
|
Block Title | N | Define the title of the group of fields. The title will be displayed above the attributes group on the relevant page of the Self-Service Portal. Info |
---|
This field appears when the Block Element value is Begin |
|
After that, a form containing fields defined by attributes bound to the model specified is displayed