SindhuC
Tera Contributor

Hi Chandan,

Let me help clarify the script used in the advanced reference qualifier:

javascript: ['incident', 'problem'].indexOf(current.sys_class_name + '') == -1 ? '' : 'operational_statusNOT IN' + new OpsStatusFilter('cmdb_ci').by('CreateTask').join()

 

Explanation:
• ['incident', 'problem'].indexOf(current.sys_class_name + '') == -1
• This checks if the current record’s class name is not incident or problem.
• If it’s not in the list, it returns -1.
• If the condition is true (== -1), the script returns an empty string — meaning no filter is applied.
• If the condition is false (i.e., the current class is incident or problem), it applies a filter:
• 'operational_statusNOT IN' + new OpsStatusFilter('cmdb_ci').by('CreateTask').join()
• This constructs a dynamic filter that excludes certain operational_status values, using a custom filter utility (OpsStatusFilter) specifically for CreateTask context.

In Summary:
• If the task belongs to incident or problem, it applies a filter to exclude certain CI statuses.
• Otherwise, it does not restrict the CI field.

Thanks,

Sindhu