Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
For a full record extension functionality using, you need to perform some additional actions. 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 add attributes out of the 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 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:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" /> |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
(() => { 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
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:
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 isin RE attributes for the Usertable. 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:
Active | true (selected) |
---|---|
Tables | User |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" /> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
( () => {
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.
Info |
---|
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.
Info |
---|
Save the ID of the record. It will be used in further steps. |
5. Create a widget for the Tasktable with the following values:
Active | true (selected) |
---|---|
Tables | Task |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<div>
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" readOnly="true"/></rem>
</div> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
( () => {
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 Taskform has read-only values of RE attributes from the User record.
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Related Articles
Panel |
---|