Creating an Incident Virtual Agent

KUddin1
Tera Contributor

Hello Everyone,

 

I'm attempting to create an incident in Virtual Agent but when I test out the OOTB Create a Incident template it displays the I'm having technical difficulties and won't be able to proceed with this discussion and immediately closes the chat. Going around the topic block is there any other way to simple create an incident using a script utility? Unfortunately going the record action utility route didn't yield any results either it immediately shuts the chat out on me as well. 

 

Thank you!

1 ACCEPTED SOLUTION

Muralidharan BS
Mega Sage
Mega Sage

Hi @KUddin1 

 

 

InOrder to make the OOB create incident work, you need to input the data requested and call that topic block inside another topic. If you have directly tested topic block it won't work. 

 

1. create user prompts for short description, description, urgency and cmdb_ci. 

2. call topic block - create incident using utilities 

3. map the variables to each of them like below

 

 

MuralidharanBS_1-1711649217112.png

 

Output

I have universal request enabled so it is generating universal req, but if don't have universal request, it will be directed to incident creation. 

 

MuralidharanBS_2-1711649364492.png

 

Thanks

 

 

View solution in original post

8 REPLIES 8

Chris D
Kilo Sage
Kilo Sage

Yes, you can use GlideRecord to create records as you can everywhere else in ServiceNow. We do this quite a bit - particularly useful for creating/updating/reading records that the user normally does not have access to.

This does give you far more power than using the native Create Record action so just be cautious - i.e. it runs as the system/doesn't respect ACLs. On the other hand, GlideRecordSecure will respect ACLs and is more "proper" generally, but it depends on your use case.

KUddin1
Tera Contributor

Hi Chris,

In my creating Incident workflow I have a script action utility as my first step with the following code. 

(function execute() {
// Create an incident record
var gr = new GlideRecord('incident');
gr.initialize(); // Initialize a new record
})()
 
Then a Text bot response that says a incident has been created. 
 
Then last step is a card response that i have filtering by the condition All>SYS ID= vavar.sinc_sysid. 
I've attached screenshots as well. 
 
I still receive the errors from the bot Can't find a valid record
and 
[PREVIEW ONLY] The topic return values are: {"created_incident_sys_id":null}
 

You're missing gr.insert(); 🙂

Hopefully yours was oversimplified just for a quick test, but remember that in between initialize() and insert() you should be setting that values of the new Incident, i.e.
gr.short_description = "Here's a short description";

gr.description = "Here's a description";

gr.assignment_group = "[group sys_id]";

etc, etc.

Muralidharan BS
Mega Sage
Mega Sage

Hi @KUddin1 

 

 

InOrder to make the OOB create incident work, you need to input the data requested and call that topic block inside another topic. If you have directly tested topic block it won't work. 

 

1. create user prompts for short description, description, urgency and cmdb_ci. 

2. call topic block - create incident using utilities 

3. map the variables to each of them like below

 

 

MuralidharanBS_1-1711649217112.png

 

Output

I have universal request enabled so it is generating universal req, but if don't have universal request, it will be directed to incident creation. 

 

MuralidharanBS_2-1711649364492.png

 

Thanks