You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 3 Next »
To take full advantage of the REM functionality you will need to perform some additional actions. A simplified procedure is described below.
- Create a record extended model.
- Create necessary attributes and bind them to the model.
- You can add attributes from the created model using the appropriate related list.
- Create a new widget using <rem> or <remform> SimpleTags (depending on whether the widget is intended for a record form or a portal page).
- Add the created widget to a record form or a portal page.
Use case 1
For example, you need to extend the Task (task) table with some attributes allowing you to handle some daily duties. To do this, complete the following steps:
- 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 form 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:
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. To get the model ID, complete the following steps:
- Navigate to Record Extended Model (REM) → Models.
- Open the required model record and find its ID using the method described here.
Without using this URL addition, a non-extended form is displayed.
As a result, a form containing fields defined by attributes bound to the selected model is displayed.
Use case 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 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.
This configuration requires the following entities:
- RE model and REM attributes for the User (user) table
- REM widget for the User (user) table
- REM widget for the Task (task) table
You will find examples of scripts and necessary settings values below.
To do this, complete the following steps:
Create a widget for the User (user) table with the following values:
Active true (selected) Tables User 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()); })();
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 further steps.
- Add the widget you created on step 1 to the User form.
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. To get the model ID, complete the following steps:
- Navigate to Record Extended Model (REM) → Models.
- Open the required model record and find its ID using the method described here.
Without using this URL addition, a non-extended form is displayed.
- Fill in the fields and save the record.
Create a widget for the Task (task) table with the following values:
Active true (selected) Tables Task 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'); })();
- Add the widget you created on step 6 to the Task form.
As a result, the Task form has read-only values of REM attributes from the User record.
- No labels