Shubham Tipnis
Kilo Sage
Kilo Sage

 

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)

       

      ShubhamTipnis_2-1751354806448.png
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

ShubhamTipnis_1-1751354773513.png

 

 

3. Monitor ML Solution
  • Progress: Ensure it reaches 100%
  • State: Should be Solution CompleteShubhamTipnis_3-1751354931473.png

     

  • Solution Statistics: Review confidence levels for “Spam” and “Not Spam”

 

ShubhamTipnis_4-1751355051165.png

 

  • 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

ShubhamTipnis_5-1751355128617.png

 

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);
 

📚 Learnings from This Use Case:
  1. Understood the basics of ServiceNow’s Machine Learning capabilities
  2. Identified necessary plugins and configurations required for PI
  3. Analysis to choose the framework as per your needs.
  4. Learned how to structure and prepare training data
  5. Explored the process of creating, training, and testing ML solutions
  6. 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.
 
 
 
Comments
HasanRaja
Tera Expert

Could you please provide the Excel sheet containing 30,000 records?

Version history
Last update:
‎07-01-2025 11:23 PM
Updated by:
Contributors