To take full advantage of the REM functionality, perform some additional actions:
For example, you need to extend the Task (task) table with some attributes that allow you to handle some daily tasks. To do so, complete the following steps:
Create a form widget as described below and save it:
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" /> |
(() => { 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()); })(); |
Navigate to the record form using the URL looking like:
https://instance.example.com/record/task?model_id=XXXXXXXXXXXXXXXXX |
Replace the X's in the URL with the model ID you are using. Without using the ID in this URL, a non-extended form is displayed. |
As a result, a form that contains the attributes of the specified model is displayed.
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 REM attributes for the User (user) table. Here, you can add read-only REM attributes of the User (user) table to the Task (task) table. That is, you can display RE models of table A on the forms of table B.
To do so, configure the following entities:
To do this, complete the following steps:
Create a widget for the User (user) table with the following values:
Active | true (selected) |
---|---|
Tables | User |
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" /> |
( () => { 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()); })(); |
Create a RE model with the attributes you need for the User (user) table.
Save the ID of the model. It will be used in the next steps. |
Navigate to the record form using the URL looking like:
instance.example.com/record/user?model_id=XXXXXXXXXXXXXXXXX |
Replace the X's in the URL with the model ID you are using. Without using the ID in this URL, a non-extended form is displayed. |
Create a widget for the Task (task) table with the following values:
Active | true (selected) |
---|---|
Tables | Task |
<div> <rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" readOnly="true"/></rem> </div> |
( () => { 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'); })(); |
As a result, the Task form has read-only values of REM attributes from the User record.