For a full record extension functionality using, you need to perform some additional actions. Below, a simplified implementation procedure can be found.

  1. Create an extension model as described above.
  2. Create necessary attributes and bind them to the model.
    • You can add attributes out of the created model using the appropriate related list.
  3. Create a new widget using <rem> or <remform> SimpleTags (based on the widget planned location, a record form or a portal page).
  4. 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 1


For example, you need to extend your Task table with some attributes allowing you to handle some daily duties. To do it, follow the procedure described above:

Create an extension model for this table.


Create attributes (consider which fields could be created on this record form within this task). There should be a single attribute for every single for field.

Create a form widget as described below and save it:

Widget Template
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" />
Widget Client Script
(() => {
  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:

Navigate to a record form using the URL looking like: https://instance.example.com/record/task?model_id=XXXXXXXXXXXXXXXXX

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:

  1. Navigate to Record Extended Model → Models.
  2. 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.

After that, a form containing fields defined by attributes bound to the model specified is displayed.

Example of usage 2


Use RE model to display attributes of some record on the form you need. For example, you need to see information about the user who initiated a task. This information is in RE attributes for the User table. Here, you can add read-only RE attributes of the User table to the Task table. That is, you can display RE models of table A on the form of table B.

This configuration requires the following essences:

  • RE model and attributes for the User table
  • REM widget for the User table
  • REM widget for the Task table

In the tabs below, you will find examples of scripts and necessary settings values.

To do this, you need to create the following records:

1. Create a widget for the User table with the following values:

Activetrue (selected)
TablesUser
Template
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" />
ClientScript
( () => {
        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());
})();

2. Create a RE model with the attributes you need for the User table.

Save the ID of the model. It will be used in further steps.

3. Add the widget you created on step 1 to the User form.

4. Navigate to a record form using the URL looking like: instance.example.com/record/user?model_id=XXXXXXXXXXXXXXXXX

The X's here stand for the ID of the model you created on step 2.

Fill in the fields and save the record.

Save the ID of the record. It will be used in further steps.

5. Create a widget for the Task table with the following values:

Activetrue (selected)
TablesTask
Template
<div>
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" readOnly="true"/></rem>
</div>
Client Script
( () => {
 
                s_widget.setFieldValue('table_name', 'user');
 
                s_widget.setFieldValue('model_id', '{id of the RE model created on Step 2}');
 
                s_widget.setFieldValue('record_id', '{id of the User record created on Step 4}');
 
                s_widget.setFieldValue('table_name', 'task');
 
 
})();

6. Add the widget you created on step 5 to the Task form.

7. Result. The Task form has read-only values of RE attributes from the User record.

  • No labels