reference qualifier

JJose
Tera Expert

I want to restrict the groups displayed in the assignment_group field on the incident form using a reference qualifier. However, I am unable to find the dictionary entry for assignment_group in the incident table. I discovered that the reference table is task, which itself references another table. I believe the base table might be sys_user_group, but I am not certain. Can someone provide guidance on this?

2 ACCEPTED SOLUTIONS

Reference Qualifier is the way to go Mate.

Only tip would be try not to hardcode Groups & if the condition is too long then call a script include. And make sure you test it well. 

-Anurag

View solution in original post

@JJose  You should mark @Sandeep Rajput's response as correct as well. 

You can mark 2 correct answers to a question.

-Anurag

View solution in original post

9 REPLIES 9

@JJose Reference qualifier is the correct approach.

Sorry Sandeep, is it possible to call a script include in a reference qualifier?, I have tried but its not working, Any tips or ideas will help me, Thanks

@JJose Yes, it is possible to call a script include in the reference qualifier, make sure that your script include method returns 'sys_idIN' and a comma separated list of sys_ids. 

This is how you can call scripts include in Reference Qualifier, eg below

AnuragTripathi_0-1716221649745.png

 

-Anurag

I am trying to use the script below to remove 2 groups from the assignment_group on the PDI instance, but it is not working. Can you check what's wrong?

 

function groups() {
// Create a new GlideRecord object for the 'sys_user_group' table
var gr = new GlideRecord('sys_user_group');

// Add a query to filter only active groups
gr.addQuery('active', true);
gr.addQuery('name', '!=', 'Database'); // Exclude the group with name 'test1'
gr.addQuery('name', '!=', 'Hardware'); // Exclude the group with name 'test2'
// Execute the query
gr.query();

// Initialize an empty array to hold the sys_id values
var groups = [];

// Iterate over the results
while (gr.next()) {
// Add the sys_id of each group to the array
groups.push(gr.sys_id.toString());
}

// Return the sys_ids as a comma-separated string
return groups.join(',');
}

Reference Qualifier --> javascript:'sys_idIN'+new TT().groups();