provides access to fields of related tables from a form, list, or script. A table contain references to other tables, and the fields in these tables can be accessed by dot-walking.
Dot-walking builds a chain of field names separated by dots. For example, incident.assigned_user.company references to the company of the user assigned to the incident.
const current = new SimpleRecord('itsm_incident');
current.get('158557395619812771');
ss.info(current.assignment_group.responsible.email);
// Info: john.doe@example.com
To speed up the script execution, getValue(property) method to get the values of the fields Reference type instead of using dot-walking.
As an example, it is preferable to use the current.getValue('reference_field') structure instead of current.reference_field.sys_id one.
Process the Context
The phone number of the caller's manager is stored only in the Employee table. To get the phone number of the manager, use the script that implements the attributes of the called record in the current element context. In this example, the current object is the object of the Task table.
The Caller field refers to the User table. To get the attribute value of the Employee child table, reload the record in the context of the current Task table. To do so, add '$$' symbols before the attribute name you are calling.
const current = new SimpleRecord('task');
current.get('161157603117108419'); // a task record where a caller is an Employee object.
ss.info( "VIP: " + current.caller.$$vip) // Info: VIP: true
ss.info( "Non-existing attribute: " + current.caller.$$NonExisting) // Info: Non-existing attribute: null
if (!!current.caller.$$manager) {
ss.info("Manager: " + current.caller.manager.getDisplayValue()) // Info: Manager: John Doe
}