Need at add attachment to the incident in Virtual Agent

Admin7267
Kilo Sage

Hello,

 

I have created VA topic to create an Incident, now I need to add File Picker to the flow and attach that attachment to the incident to be created.

Admin7267_0-1715777124191.png

Admin7267_1-1715777600976.png

 

 

Script to create incident:

(function execute() {
    
var incGr = new GlideRecord("incident");
incGr.initialize();
incGr.setValue("caller_id", vaInputs.callerid);
incGr.setValue("short_description", vaInputs.short_description);
incGr.setValue("contact_type", "virtual_agent");
incGr.setValue("category", vaInputs.category);
incGr.setValue("subcategory", vaInputs.subcategory);

create_incident = incGr.insert();
vaVars.inc_sys_id2 = create_incident;

})()

 

Script to add attachment to inc:

(function execute() {
    vaSystem.attachToRecord(vaInputs.attachments.getValue(), incident, vaVars.inc_sys_id2);
})()

 

Previously incident is created. but now even incident is not creating.

7 REPLIES 7

Sohail Khilji
Kilo Patron
Kilo Patron

try :

 

(function execute() {
    
var incGr = new GlideRecord("incident");
incGr.initialize();
incGr.setValue("caller_id", vaInputs.callerid);
incGr.setValue("short_description", vaInputs.short_description);
incGr.setValue("contact_type", "virtual_agent");
incGr.setValue("category", vaInputs.category);
incGr.setValue("subcategory", vaInputs.subcategory);

var create_incident = incGr.insert();
vaVars.inc_sys_id2 = create_incident;

})()

☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Thanks @Sohail Khilji  for the response,
I main query is to add the attachment to the incident after created.

If I remove the Script to add attachment to inc, then incident is creating.

Hi @Admin7267 ,

 

For arrachement > here is the solution :

 

https://www.servicenow.com/community/virtual-agent-nlu-articles/virtual-agent-user-input-image-picke...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

I followed the same thread to add the attachment, but it's not working.