Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to add filter to the assignment group field in the modal pop-up?

Vasu20
Tera Contributor

I want the assignment group field in the modal to load only support groups where can i add the filter condition in the code here so that it shows only those.

function onClick(g_form) {

g_modal.showFields({
title: "Please provide all information for incident",
fields: [{
type: 'textarea',
name: 'u_incidentreason',
label: 'Incident description:',
mandatory: true
}, {

type: 'reference', // type of modal (ie text, reference, etc)
name: 'assignment_group', // reference field on the current record used to search
label: 'Assignment Group', // message to display above the search field
mandatory: true, // sets the field to mandatory
reference: 'sys_user_group', // table that the reference field in "name" refers to
referringTable: 'incident', // table of the current record
referringRecordId: g_form.getUniqueValue() // sys_id of the current record

}],
size: 'md'

}).then(function(fieldValues) {

g_form. setValue('u_incidentreason', fieldValues.updatedFields[0].value); 
g_form.setValue("u_incident_creation", 'true'); 
g_form.save();

}

1 ACCEPTED SOLUTION

Glad to help.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

11 REPLIES 11

BharathChintala
Mega Sage

@Vasu20 

add like this change it to how you want

"query" : "caller_id=" + g_form.getValue("caller_id"),

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

This is not working, is this tested?