- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 04:31 AM
Hello Community,
I Have a requirement how can I show field info message on a field(customer) based on color of text inside the field. for example, I have customer field of reference type when I select X (option) the color of X changes to red color, and if I select Y(option), the color Y changes to green color, and if I select Z(option), the color is default. like this I have many options and color of selected option changes based on selection. (I have a script to change the color based on selection)
Now when the color of text is red I need to show info message(?) for customer field as "this customer is in red zone" when the color of text is green I need to show info message(?) for customer field as "this customer is in green zone"
Can anyone suggest how to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 08:31 AM
Hi @Hemanth Naik,
Glad to see that you are following my solution. I'll make sure that your query got solved as soon as possible.
Proposed Solution
As per the code you pasted in tailing to my proposed solution, one suggestion from my side that you should not make a "Glide Record" on "Client Side". Instead of this, you should make a "Glide Ajax" call and make a "Script Include". I hope, you are able to get this point of view.
As a solution, you just need to add 2 methods of "g_form" like "showFieldMsg()" and "showErrorBox()" in your script as mentioned below. I personally tried it on my Personal Developer Instance to get your query solved as soon as possible. Hope this finds you helpful.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.showFieldMsg('caller_id', 'This user is in blue zone');
g_form.showErrorBox('caller_id', 'This user is in red zone');
}
For your reference, also attaching screenshots of the outputs that will give you better insights of how this script is working or the best thing will be to follow the solution and execute the script on your instance.
Output: -
If you find any reply/information/knowledge/solution helpful, please don't forget to mark my solution and reply as helpful and accepted.
Thanks :)
Aakash Garg
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 09:22 AM
Glad to hear that @Hemanth Naik. Let me know if any help needed while creating Script Include or something else. I'll be happy to assist you.
If you find any reply/information/knowledge/solution helpful, please don't forget to mark my solution and reply as helpful and accepted.
Thanks :)
Aakash Garg
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 04:16 AM
Hi @AakashG2703 , Thankyou for your assistance , I have done this requirement through script include.
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 04:35 AM
Hi @Hemanth Naik,
Hope you are doing well.
Glad to hear that you are following my assistance and happy to work with you on your question or query asked in the community and get it resolved. Thanks again for marking my proposed solution as helpful and accepted 🙂
If you find any information/knowledge/solution helpful, please don't forget to mark my solution and reply as helpful and accepted.
Thanks :)
Aakash Garg
ServiceNow Developer