How to replace the ui_reference query in UI Page with the client side function?

Anmol12
Tera Contributor

II have a requirement in the Risk Assessment where the Reassign button opens the “reassign_coordinator” UI Page with an “Assessor” field. I want to modify the reference qualifier query for the Assessor field to only include members belonging to the assessor group. To achieve this, I created a function in a client script that calls a script include function to retrieve the assessor group members. However, I am unable to replace the current query with my function.
Query which I want to replace with function - query="active=true^roles=sn_grc_reg_change.user^EQ"

<g:ui_reference name="coordinator" id="coordinator_name" table="sys_user" field="name" query="active=true^roles=sn_grc_reg_change.user^EQ" onchange="checkMandatoryFields(this)"/>

Anmol12_0-1737127825794.png

 



I want to replace the query with my function. How should I define it?

Any help is appreciated.

Thanks,
Anmol

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Anmol12 

check this link where I shared solution on how to set the filter when UI page loads in g:ui_reference, please see that and enhance as per your requirement

Store value in reference field of ui page using client script 

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

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

Anmol12
Tera Contributor

Hi Ankur, thanks for looking into this, I need to populate the members only from the assessor_group field only present on the assessment record, how should I query to get the members only present to group at that time?