Heapselect is commonly used for the list and form layout configuration.
Another case of using the heapselect tool is editing synthetically related lists on a record form. The heapselect allows changing you to change the selection set of records displayed in the list.
Tip |
---|
|
- Configure the heapselect URL.
- Create a URL Action using the heapselect URL or simply share the URL with other users.
When the user follows the link, the records displayed are always checked by the ACLs. |
Image Removed
Using the heapselect Anchor |
---|
using the heapselect | using the heapselect | After heapselect URL configured, use the heapselect options following the steps below:
Use the URL to enter the form and select the desired records. The left box (Available) contains all the table fields excluding selected ones. The records of the right box (Selected) are selected for further script applying. Move elements by drag-and-dropping or using the
Image Removed and
Image Removedbuttons.
Info |
---|
- To remove or add all the fields, click the
Image Removed or Image Removed buttons. - To move several elements in a row, select them with the Shift key pressed and drag-and-drop from the Available box to the Selected one.
- To move several scattered elements at once, select them with the Ctrl key pressed and drag-and-drop from the Available box to the Selected one.
|
Click Save to apply the heapselect script to the records of the Selected box.
Image Added
Heapselect URL configuration
Anchor |
---|
| heapselect configuration |
---|
| heapselect configuration |
---|
|
Info |
---|
title | How the heap-select heapselect works |
---|
|
The heapselect URL performs the following actions to the essence table: - The server returns lists of records by their sys_id in two boxes using GET-parameters:
- In the left box – records filtered by the condition are are available for the manual selection by user.
In the right box – the custom script include (select_ids_script_id) returns specific table records by their sys_id. Section |
---|

|
- (Optional) The title and the column value (display_value) displayed may be configured.
- When clicking Save, the script_id script include applies to all the record selected.
|
To configure the heapselect URL, use the GET-parameters and the view below:
Code Block |
---|
|
<your_instance_URL>/<page_name>/<table_name>?condition=<conditional_expression>
&selected_ids_script_id=<script_returning_sys_ids>
&script_id=<script_applied>
&display_value=<column_name>
&title=<some_text>
&field_name=<field_value>
&form_view=<form_view_name> |
GET-parameters description
GET parameter | Description |
---|
essence |
A The system name of the source table. |
condition |
Build string String conditions for table records filtering using |
the simply apply the apply the desired filter or the |
|
Condition Builder condition builder settings to the table in a list form, then copy the condition body from the browser URL and use it as the heapselect condition. Learn more about how the filter works. |
|
select_ids_script_id |
A custom The custom Script Include that returns the list of the essence table records IDs (sys_ids) as operation results. When applying this script, the heapselect adds table records with the returned sys_ids |
in the right box (the ) This is that is applied to the essence table records contained in the |
right box (the ) of the form. |
display_value |
Define theThe name of a column to be displayed as record names in the heapselect form. |
title |
Use this option to set the The string title of the heapselect form. By default, |
the the Select Items title displayed. |
parent_id |
Specify the to that will be affected by the action applied. |
parent_table |
Specify the to that will be affected by the action applied. |
field_name |
Set A value to a specific field. |
form_view |
Use this option to set the The view of the form or a list. All users will switch to the defined view regardless of their preferred view. |
Heapselect usage Anchor |
---|
| using the heapselect |
---|
| using the heapselect |
---|
|
After the heapselect URL configured, use the heapselect options by following the steps below:
Use the URL to enter the form and select the desired records. The Available box contains all the table fields, excluding selected ones. The records of the Selected box are selected for further script applying.
Move elements by dragging them or using the
Image Added and
Image Addedbuttons.
Info |
---|
- To remove or add all the fields, click the
Image Added or Image Added button. - To move several elements in a row, select them with the Shift key pressed and drag them from the Available box to the Selected one.
- To move many scattered elements at once, select them with the Ctrl key pressed and drag them from the Available box to the Selected one.
|
- Click Save to apply the heapselect script to the records of the Selected box.
Use
User case
Panel |
---|
|
Case: Add a related Configuration Item list to an Employee table record, where the selection condition is Location is {current user Location}. |
To configure the Related Lists with heapselect, perform complete the following steps:
Create a related list using the Scripted Related Lists tool. In our this case, it is CI my Location.
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | Scripted Related List example |
---|
linenumbers | true |
---|
|
if(Boolean(parent.sys_id)){
current.addQuery('location', parent.location.sys_id);
} |
Create a script includeScript Include. In our this case, it is heapSelectExecute.
Section |
---|
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | heapSelectExecute example |
---|
linenumbers | true |
---|
| setResult(heapSelectExecute(essence, selectedIds));
function heapSelectExecute(essence, selectedIds) {
let selectedElements = [];
let record = new SimpleRecord(essence);
record.addQuery('sys_id', 'IN', selectedIds);
record.query();
record.setMultipleValue('location', parent.location.sys_id);
record.updateMultiple();
} |
|
Add a UI - action to the created related list with the following settings:
Field | Value |
---|
Table | The table displayed in this related list. |
Conditions and Actions |
---|
Show Insert |
'true |
' |
Show Update |
'true |
' |
URL | Heapselect URL with all the necessary parameters |
. See the Heapselect URL configuration section of this article to learn more. Code Block |
---|
| /heap-select/sys_cmdb_ci?condition=(ci_status!=1)&select_ids_script_id=158764810812561263&script_id=158764868812483099&display_value=number&title=Edit CI Location |
|
Position and Style |
---|
Use For | Related Lists |
Scripted List |
'true |
' |
List Banner ButtonHeader Left |
'true |
' |
As a result, there is an editable a related list on the Employee record form. A user can add or remove records from the list of configuration items which that have the same location as the employee.

