How to re format incident description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Dear all,
I have setup a Twilio voice agent which is capable of creating an Incident based on a voice agent conversation
The voice agent is asking some question and then based on my reply send the conversation in the incident description as seen below
As you can see from description field, the question and answer are formated strangely.
What I would prefer is to have a summarize of the conversation and points discuss enumerated as bullet point or other natural information by avoiding Question = Answer
I am using for that the OOTB "Create incident with voice AI agent" which is an Action ITSM which is refered from configuration
What I would like to do is that :
- incident desciption is written in a different way before creating the incident ( prompt adjust maybe)
- Incident category and Subcategory set correctly according to conversation
- Incicent impact and Urgency set corrcetly as well
- Incident chanel should be set to Voice Agent
Any idea how should I update the Ai Agent to reflect my change ?
Do I need to add some extra tool which does this OOTB ?
Do I need to update the prompt at some point ?
I have notice that when I click on this voice Agent I do not see how to adjust or add tools if needed and Test it before publishing. It is done in a form of different way than Skill
Any idea how to do to reach my goal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Naveen20 , I think we are not on same path. I am not able to test my agent from root. I can only test my flow action
Here is a short video
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The incident INC0010092 was created but all fields are wrong:
| Field | Expected | Actual on Incident |
|---|---|---|
| Short description | "Test short description" | BLANK |
| Description | "Test description" | BLANK |
| Category | Software | Inquiry / Help (default) |
| Subcategory | None | |
| Impact | High (1) | 3 - Low |
| Urgency | High (1) | 3 - Low |
| Caller | serge calderara | Empty |
| Channel | — | Phone ✅ (only one that worked) |
Root Cause
Two issues in the Script Step:
1. Dot notation (gr.field = value) is unreliable in Flow Designer script steps. You must use gr.setValue('field', value) instead. That's why short_description, description, and category are all blank/default.
2. Impact and Urgency store numeric values (1, 2, 3), not labels like "High". The LLM will pass labels, so you need a mapping function.
The Fixed Script
Replace your entire Script Step with this:
(function execute(inputs, outputs) {
// Helper: map label to numeric value for impact/urgency
function mapPriority(val) {
if (!val) return '3'; // default Low
var v = val.toString().toLowerCase().trim();
if (v === '1' || v === 'high') return '1';
if (v === '2' || v === 'medium') return '2';
if (v === '3' || v === 'low') return '3';
return '3';
}
// Helper: validate category against sys_choice
function isValidChoice(table, field, value) {
if (!value) return false;
var ch = new GlideRecord('sys_choice');
ch.addQuery('name', table);
ch.addQuery('element', field);
ch.addQuery('value', value);
ch.setLimit(1);
ch.query();
return ch.hasNext();
}
var gr = new GlideRecord('incident');
gr.initialize();
// Use setValue() — NOT dot notation
gr.setValue('short_description', inputs.short_description || '');
gr.setValue('description', inputs.description || '');
// Impact and Urgency — map "High"/"Medium"/"Low" to 1/2/3
gr.setValue('impact', mapPriority(inputs.impact));
gr.setValue('urgency', mapPriority(inputs.urgency));
// Category — validate before setting
if (inputs.category) {
if (isValidChoice('incident', 'category', inputs.category)) {
gr.setValue('category', inputs.category);
} else {
// Try lowercase match
var catLower = inputs.category.toString().toLowerCase();
if (isValidChoice('incident', 'category', catLower)) {
gr.setValue('category', catLower);
}
}
}
// Subcategory
if (inputs.subcategory) {
if (isValidChoice('incident', 'subcategory', inputs.subcategory)) {
gr.setValue('subcategory', inputs.subcategory);
} else {
var subLower = inputs.subcategory.toString().toLowerCase();
if (isValidChoice('incident', 'subcategory', subLower)) {
gr.setValue('subcategory', subLower);
}
}
}
// Channel — hardcode for voice agent
gr.setValue('contact_type', 'phone');
// Caller lookup
if (inputs.caller) {
var userGr = new GlideRecord('sys_user');
userGr.addQuery('name', 'CONTAINS', inputs.caller);
userGr.setLimit(1);
userGr.query();
if (userGr.next()) {
gr.setValue('caller_id', userGr.getUniqueValue());
} else {
// Try email
userGr = new GlideRecord('sys_user');
userGr.addQuery('email', inputs.caller);
userGr.setLimit(1);
userGr.query();
if (userGr.next()) {
gr.setValue('caller_id', userGr.getUniqueValue());
}
}
}
var incSysId = gr.insert();
if (incSysId) {
gr.get(incSysId);
outputs.incident_number = gr.getValue('number');
outputs.incident_sys_id = incSysId;
outputs.success = true;
outputs.message = 'Incident ' + gr.getValue('number')
+ ' created successfully.';
} else {
outputs.success = false;
outputs.message = 'Failed to create incident.';
outputs.incident_number = '';
outputs.incident_sys_id = '';
}
})(inputs, outputs);
Key Differences from Your Current Script
gr.setValue()everywhere instead ofgr.field =— this is the main fix for the blank fieldsmapPriority()function converts "High" → "1", "Medium" → "2", "Low" → "3" — fixes impact/urgencyisValidChoice()function validates category/subcategory againstsys_choicebefore setting — prevents silent failures- Caller lookup uses CONTAINS on the
namefield — more flexible for matching "serge calderara"
About the PlanContextBindingStrategy Error
That error in the flow log is a known Flow Designer internal issue when testing Actions directly — it's not caused by your script. You can safely ignore it. The incident was still created; the fields just weren't populated due to the dot notation issue.
Quick Verification
After updating the script, re-test with the same inputs. On the incident you should see all fields correctly populated. The category values on your instance are likely lowercase (software, email) — the script now handles both cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Dear @Naveen20 , I come back to this case where I do not change the OOTB script for creating the incident and leave it as it is by default.
The only thing I try to cover and solved first is to tell the model to format the desription of the incident without the Question / Answer style but more as a summary of the discussion
Fir that I have updated the model to be simply like the follwoing because it is just a matter of formatting the fields.
List of steps for the model :
1. Ask the user what issue they are facing today
- If the reply is vague, ask for clarifying detail until a complete sentence explaining the issue is received
2. Ask at least minimum 3 targeted follow-up questions to provide more troubleshooting context. Acknowledge answers briefly; do not repeat or confirm them individually
3. Ask user the impact situation in is work
4. When you have enough information, perform the single recap and ask for a quick confirmation
5. Before creating the incident, rewrite the conversation as a professional summary paragraph followed by bullet points of key details (issue, onset, errors, scope). Never use Question/Answer format. Classify the incident category, subcategory, impact (1-3), and urgency (1-3) based on the conversation context. Always set contact type to Voice Agent
4. Create the incident and read the incident number back to the user
By adding the step 5, the AI still set the description in a format with Question : Answer
Any idea what is missing ?
regards
