How to add magnifying search icon functionality in pop up window form reference field in workspace?

Ankita Kolhe
Tera Contributor

Hi Community,

 

I have an UI Action in Workspace & on clicking on it ,  opens a new pop up window form which consist of a reference field.

 

AnkitaKolhe_0-1706512231081.png

This is a reference field but not having reference search icon & functionality added. The need is to have a reference icon & when user clicks on it, should open a pop up window with list of records ( same as OOB reference field).

 

Please find the UI Action code below:-

 

function onClick(g_form) {
   
    var fields = [

        {
            type: 'reference',
            name: 'add_parent',
            label: getMessage('Entity'),
            mandatory: true,
            reference: 'entity_management_base',
            referringTable: 'entity_management_base',
            referringRecordId: g_form.getUniqueValue(),
        }
    ];

    g_modal.showFields({
        title: getMessage("Map Parent Entity"),
        fields: fields,
        cancelTitle: getMessage("Cancel"),
        confirmTitle: getMessage("Submit"),
        cancelType: "default",
        size: "lg",
        confirmType: "confirm"
    }).then(function(fieldValues) {
       
        g_form.setValue('add_parent', fieldValues.updatedFields[0].value);
        g_form.submit('add_parent_action');
    });


}
 
Please let me know if someone can help on this.
 
Thanks,
Ankita
5 REPLIES 5

Ahana 01
Tera Expert

To add a magnifying search icon functionality in a pop-up window form reference field in ServiceNow workspace, you can follow these steps:

1. Navigate to the form where you want to add the reference field.
2. Click on the "Configure" option in the form and select "Form Design".
3. In the Form Design window, select the "Reference" field type from the left panel.
4. Drag and drop the "Reference" field type to the desired location on the form.
5. In the "Field Properties" window, provide the necessary details like "Label", "Name", and "Reference" specifies the table to reference.
6. Save the changes.
7. Now, when you open the form in the workspace, you will see a magnifying glass icon next to the reference field. Clicking on this icon will open a pop-up window with a list of records from the referenced table.

Please note that the above steps are for adding a new reference field. If you want to add a magnifying glass icon to an existing reference field, you need to ensure that the field type is set to "Reference" and the referenced table is specified correctly.

Hi Ahana,

The steps you have mentioned is for native view forms & not for workspace.

 

Thanks,

Ankita

These are generated from Chatgpt 🙂

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Ankita Kolhe 

 

I think it sis by design.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0714703

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************