Change text if no results found
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:11 AM
I have a very simple check record form that our HR team uses.
It has the following
1. Position ID to Check - text. They can enter what they want
2. Available asset - Reference to the ALM table. We look at the Position ID, and it returns what device is assigned, if available.
The question I have been asked to review
If there is No Matches Found, can I change that Text to read something like - Please contact IT ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:22 AM
Nevermind...
Found this
https://www.servicenow.com/community/itsm-forum/how-to-change-no-matches-found-message-for-a-referen...
and it notes that it could break a lot of things if you change it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:54 AM
Hello @Brian Sorensen ,
a bit complicated solution is possible. It involves a client script, script include and additional variable/field message
- Create an on change client script on the Position ID to Check, every time the field changes it is going to call a the script include with GlideAjax.
- Create a rich text variable that contains the text you want (Please contact IT ), you can make it bold, read or something else, put it under the Asset variable and make it hidden.
- Create the script include, it is going to contain one function that is going to check the Asset table with the reference qualifier that you are going to build and if it finds record it is going to return true, if no false
- The client script receives the response from the script include with a callback function, if there are no records in it (the response is false) it is going to make the Available asset read only and it is going to show the rich text variable.
This is a solution if you are using a Catalog item if you are on back-end form you can do the same but replace the variable with a field message
g_form.showFieldMsg('availabele_asset','Please contact IT ','info');
Hope that this helps you!
If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.
All the Best,
Stefan