Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

is the incident create ?

are you able to get the sys_id of the incident after insert (); ? did you log it ? 

 


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

LinkedIn - Lets Connect

Yes incident is getting created and I used gs. log(create_incident) and I see sys_id of new incident is showing. 

This thread is not helpful as Record action utility is used to create incident

But I have used script action utility to create incident