- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 09:53 PM
on "sn_customerservice_case" what I need is to designed a display a message on a ServiceNow form, alerting users to check certain fields that have been predicted by AI for accuracy.
OOB script include "CSMAIDisplayAjax" is there already. Can anyone help me out
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 07:02 AM
Hello,
Its OOB script we can use :-
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:30 PM
Can you confirm whether it worked or not ??
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:49 PM
One More Easy way is below :-->
Create a Client Script: To display a message on the form, you can use a Client Script to execute the logic and display the message. The Client Script will call the Script Include method to fetch any prediction results and then use those results to display a message.
Here’s an example of a Client Script that could be used:
// Client Script: onLoad
(function executeRule(current, previous /*null when async*/) {
// Call the Script Include function to get predictions
var gr = new GlideAjax('CSMAIDisplayAjax');
gr.addParam('sys_id', current.sys_id);
gr.getXMLAnswer(function(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
if (result) {
// Display message based on the result
g_form.addInfoMessage('AI has predicted some fields for accuracy check: ' + result);
}
});
})(current, previous);
- This script sends the
sys_id
of the current record to the Script Include and retrieves a response. - It then displays an info message on the form with the result.
var CSMAIDisplayAjax = Class.create(); CSMAIDisplayAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, { getPredictedFields: function() { var sys_id = this.getParameter('sys_id'); // Example logic to retrieve predictions var message = this.getPredictions(sys_id); // Implement this function as needed return message; }, getPredictions: function(sys_id) { // Add logic to fetch and return predictions based on sys_id // Example: var predictions = 'Field1, Field2'; // Placeholder for actual predictions return predictions; } });
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 07:02 AM
Hello,
Its OOB script we can use :-
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 11:43 AM
Can you show an example of this client script in action ? (Screenshot)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:30 PM
Can you confirm whether it worked or not ??
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:35 PM
Yes definitly it worked