
Shubham Tipnis
Kilo Sage
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
07-01-2025 11:20 PM - edited 07-01-2025 11:23 PM
Hello everyone,
I recently had the opportunity to work on a Predictive Intelligence (PI) use case in ServiceNow. The use case itself was quite straightforward, but a great starting point to understand how PI works in real scenarios. Since I struggled a bit due to the lack of consolidated resources, I’m sharing my experience here in the hope that it helps others starting out with PI.
✅ Use Case:
Predict if an incoming message is spam or not.
📥 Input:
A dataset containing over 30,000 records, each with a message description and its corresponding spam classification.
🔧 Development Steps:
1. Create a Custom Table
-
App Scope: Scoped app (e.g., Spam Test)
-
Fields:
-
Description
(String) -
Spam Prediction
(String with choices)
2. Create a Classification Definition
Go to Predictive Intelligence > Solutions > Classification Definitions
-
What are you interested in predicting?
-
Table: Spam Test
-
Output Field: Spam Prediction
-
What input data is helpful to predict the output field?
-
Input Field: Description
-
Submit & Train
3. Monitor ML Solution
-
Progress: Ensure it reaches 100%
-
State: Should be Solution Complete
-
Solution Statistics: Review confidence levels for “Spam” and “Not Spam”
-
Test Solution:
-
Input a sample spam message
-
Choose
Top N
results (e.g., 1 or 2) -
Run the test and check the predicted values and confidence levels
4. Use the ML Solution via Script
You can invoke the model using a BR, SJ or any other script as per your need.
var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_x_dstp_x_dstp_trai_pi_global_trai_data_spam_classification_v4"); //name of classification solution definition
var options = {};
options.top_n = 1;
var results = mlSolution.predict(current, options);
// using the script in BR so used 'current' object. You can glide any table and pass the GR object like mlSolution.predict(inputGR)
// results are returned in array objects format something like this: {"b26237da1b52aa50b7e7fc4f034bcbd3":[{"confidence":95.94929814338684,"threshold":0.0,"predictedValue":"Not Spam","predictedSysId":""}]}
var predictionObj = JSON.parse(results);
var dynamicKey = Object.keys(predictionObj)[0];
current.setValue('spam_prediction', predictionObj[dynamicKey][0].predictedValue);
Script reference: https://www.servicenow.com/docs/bundle/yokohama-intelligent-experiences/page/administer/predictive-i...
📚 Learnings from This Use Case:
-
Understood the basics of ServiceNow’s Machine Learning capabilities
-
Identified necessary plugins and configurations required for PI
- Analysis to choose the framework as per your needs.
-
Learned how to structure and prepare training data
-
Explored the process of creating, training, and testing ML solutions
-
Implemented script-based logic to leverage ML predictions in workflows.
I’m currently exploring the Predictive Intelligence Spoke in Flow Designer to build no-code flows for similar use cases. Once I complete that, I’ll share another article with my learnings.
Thanks for reading! Hope this helps anyone looking to get started with PI in ServiceNow.
Regards,
Shubham
🎯 ServiceNow Enthusiast
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
🚀 Sharing insights, use cases & real-world learnings from the Now Platform
🔗 Always learning. Always building.
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
🚀 Sharing insights, use cases & real-world learnings from the Now Platform
🔗 Always learning. Always building.
- 1,228 Views
Comments
HasanRaja
Tera Expert
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Monday
Could you please provide the Excel sheet containing 30,000 records?