- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Monday - edited Monday
1. Why GenAI for Catalog Items and Record Producers?
Catalog Items and Record Producers are often the first touchpoint for employees and consumers. They collect structured inputs, trigger workflows, and create records - but they rarely understand the context behind the request.
With a Now Assist Custom Skill we can transform these forms into intelligent, context-aware experiences that:
- Interpret user intent
- Summarize long inputs
- Generate tailored messages
- Validate or enrich form data
- Guide users through complex submissions
This article uses the Tailored SMS use case as a blueprint for building GenAI-enhanced Catalog Items and Record Producers.
2. The Use Case: Tailored SMS
Agents often need to send SMS messages during live calls or chats. The challenge:
- The message must match the conversation
- It must follow the correct template
- It must be short, clear, and compliant
- It must be generated in seconds, while the agent is still talking
This is a perfect GenAI use case.
3. Solution Architecture Overview
Below is the architecture pattern used for Tailored SMS and applicable to Catalog Items and Record Producers.
High-Level Architecture
User Input (Catalog Item / Record Producer)
↓
Client Script (trigger)
↓
Script Include (server call)
↓
Subflow (Execute Skill)
↓
Custom Skill (Tailored SMS)
↓
Generative AI Config (LLM)
↓
Response returned to UI
This architecture is modular, scalable, and reusable across any form.
3. Now Assist Custom Skill: Tailored SMS
In Deployment and skill settings the Flow Action have to be set to "true".
4. Subflow: Tailored SMS > Execute Skill
The subflow Tailored SMS orchestrates the execution.
Flow Action (Excerpt)
5. Script Include: Server-Side Execution
The Script Include acts as the server-side bridge.
Script Include (Excerpt)
// function in the SMSRecProducerAjax client callable Script Include
tailoredSMS: function() {
var countryId = this.getParameter('sysparm_country_id');
var consumerID = this.getParameter('sysparm_consumer_id');
var smsType = this.getParameter('sysparm_sms_type');
var interactionID = this.getParameter('sysparm_interaction');
// Call backend Script Include
var backend = new SMSBackend();
var smsText = backend.generateTailoredSMS(countryId, consumerID, smsType, interactionID);
return smsText; // Return plain string
}
______________________________________________________________________
// the Script Include triggering the flow
var SMSBackend = Class.create();
SMSBackend.prototype = {
initialize: function() {},
generateTailoredSMS: function(marketId, consumerId, smsType, interactionId) {
try {
var grInteraction = new GlideRecord('interaction');
grInteraction.get(interactionId);
var inputs = {};
inputs['transcript'] = grInteraction.transcript.toString();
inputs['sms_type'] = smsType;
inputs['language'] = 'English';
// Execute and wait for completion + retrieve outputs
var outputs = sn_fd.FlowAPI.executeSubflow('sn_csm_gen_ai.tailored_sms', inputs);
// Extract SMS text
var smsText = outputs['sms_preview'];
return smsText;
} catch (ex) {
gs.error("Tailored SMS Error: " + ex.getMessage());
return '';
}
},
type: 'SMSBackend'
};
6. Client Script: Triggering the Generation
A simple onChange Client script can call the Script Include via GlideAjax.
Client Script (Excerpt)
function onChange(control, oldValue, newValue, isLoading) {
var consumerID = g_form.getValue('consumer');
var smsType = g_form.getValue('sms_type');
var countryID = g_form.getValue('country');
var interactionID = g_form.getValue('source_interaction');
var sysparmName = (smsType == 'tailored_sms') ? 'tailoredSMS' : 'checkTemplates';
var ga = new GlideAjax('SMSRecProducerAjax');
ga.addParam('sysparm_name', sysparmName);
ga.addParam('sysparm_consumer_id', consumerID);
ga.addParam('sysparm_sms_type', smsType);
ga.addParam('sysparm_country_id', countrytID);
ga.addParam('sysparm_interaction', interactionID);
ga.getXMLAnswer(function(response) {
if (smsType == 'tailored_sms') {
g_form.setMandatory('sms_template',false);
g_form.setVisible('sms_template',false);
g_form.setValue('sms_preview', response);
g_form.setReadOnly('sms_preview',false);
g_form.setMandatory('sms_preview',true);
g_form.addDecoration('sms_preview', 'icon-ai-sparkle-fill', 'AI','color-green');
g_form.showFieldMsg('sms_preview',"This is AI generated text. Please, review before sending!",'warning');
}
});
}
7. Applying This Pattern to Catalog Items/Record Producers
Example Variables
Variable | Type | Maps to |
sms_type | Choice | action / intent |
sms_template | Reference | sms_template |
language | Choice | language |
sms_preview | String | AI output |
8. Final Thoughts
The Tailored SMS solution demonstrates a powerful pattern:
- Any Catalog Item or Record Producer can become GenAI-enhanced with only a client script, a Script Include, and a Flow that executes a Now Assist Custom Skill.
- This architecture is clean, scalable, and fully aligned with ServiceNow best practices.
Additional Documentation:
- 199 Views
