- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 01:12 AM
Hi All ,
I am new to reference qualifier. I have a task to set reference field look up in such a way that , it should sort look up according to whatever is populated in that reference field .
For example:
1. I have one reference field on cases and it is populated with value New_tenant.
2. Now once I open look up it should display only those record which start with New, like this.
In order to achieve this I want to use Advanced reference qualifier of that field and set look up in such manner. Please help suggesting something.
cc: @Ankur Bawiskar @kamlesh kjmar
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 10:35 PM
Hi @Abhijit Das7 ,
For your use-case, first you need to decide one logic for the filter condition. For an example in the above screen shot you want your filter to search for record that starts with New so for that logic becomes :
Split the selected value by under score symbol and then use the first split to search, but this logic won't work if there a name with no '_' symbol in it.
You can think of another logic where you can split the selected value by space and use the first split as a search word but this will not work for the names which are separated by '_'
One last logic you can come-up with is take a substring of the selected name, say select first 3 characters of the selected name and use it for filtering. This you can consider. I am showing you how you can achieve your functionality with this logic:
1. I am taking an example of a custom field in incident table Device Incident which is referencing to incident table.
Now in this I am putting the logic that if you select any incident in this and then if you click on the search icon of the field it will filter and show only those incidents whose Number starts with first seven character of the incident already choosen. In the above example it will show incidents whose number starts with INC0019
Below is the logic I have used in my reference qualifier of Device Incident field
javascript:current.getValue("u_device_incident") != "" ? "numberLIKE"+(current.getDisplayValue("u_device_incident")).substr(0,7):"numberISNOTEMPTY"
Change your filter logic as per your requirement, but process of doing this will remain the same.
I hope this helps.
If this solution helps you then please hit the Helpful button and if this solves your issue then hit Accept button as well.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 11:08 PM
you can try this in advanced ref qualifier
javascript: var query; if(current.x_care3_carear_cus_carear_instruct_experience) query = 'nameSTARTSWITH' + current.x_care3_carear_cus_carear_instruct_experience; else query = ''; query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 03:57 AM
Hello Abhijit ,
If you can achieve this by simple reference qualifier , why you are forcing to use advanced reference qualifier.
you can use this as mentioned by Sharif :
1. On the form, right click on the "CareAR Instruct Experience" click on "Configure Disctionary".
2. Now a Dictionary Entry will open.
3. In the "Reference Specification" Tab, in Reference qual Condition, add a condition.
4. Name >> Starts With>> New.
5. Click on update.
This will allow you to search only the results starts with New.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 04:25 AM
If I'm understanding your requirement correctly, I would do this a bit differently. Store New_Tenant elsewhere (such as on the contact record or in another field on the case form). Then, in your CareAR Instruct Experience field, set the reference qualifier such that it calls a script include, sending the value of the field where New_Tenant is stored. The script include will filter the table based on that value and return only the values containing 'new'.
For example, in your contact record, add a choice field called Tenant type. Give it the appropriate options, New tenant (new_tenant) being one of them.
Then create a script include with a function that takes in the value of Tenant type and filters the records in the CareAR Instruct Experiences based on that value. Call that script include in your reference qualifier.
If this is a viable option, I can provide some specifics.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 09:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 10:21 PM
Hi @Shashank_18
There is one field called CareAr Instruct Experience on cases field . it is referenced to a table Instruct Experience which has field Experience name ( display = true ) .
So , look up will show this table field Experience Name .
Thanks