How to create sys property Reference type and List Type

Varsha A
Tera Contributor

How to create sys property Reference type and List Type so that we can select values from table instead of adding comma separated sys_ids.

 

 

 

7 REPLIES 7

Abhay Kumar1
Giga Sage

@Varsha A Navigate to sys_properties.list and click on new to create a new property.

For reference type:

Type: Choose Reference from the dropdown.

Reference Table: Choose the target table you want to reference (e.g., cmdb_ci_computer, incident, user, etc.).

Default Value: This can be left empty or can be set to a default sys_id (if needed).

 

And for other Choose List from the dropdown.

To utilise properties in script :

Reference Property:

var refValue = gs.getProperty('your_table_reference_property');

var gr = new GlideRecord('cmdb_ci_computer');

gr.get(refValue); // Retrieves the referenced record based on the sys_id

 

List Property:

var listValue = gs.getProperty('your_table_list_property');

var sysIds = listValue.split(','); // Split the comma-separated sys_ids

var gr = new GlideRecord('cmdb_ci_computer');

gr.addQuery('sys_id', 'IN', sysIds);

gr.query();

while (gr.next()) {

    // Process each record in the list or add your logic as per your requirement.

}

Hope this will help you.

 

 

Hi @Abhay Kumar1 

we don't have type reference  available : "Type: Choose Reference from the dropdown."  

Runjay Patel
Giga Sage

Hi @Varsha A ,

 

Did not understand you fully, Are you trying to get the reference value from property? Please explain bit more your requirement.

Hi @Runjay Patel , yes i want to create property of type reference or List, so that i can select values from table.

e.g. i would like to select user from the reference field.