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.

Attachment via Virtual agent

preethigovi
Tera Contributor

Hi Team,

 

I trying to add attachment via VA, and its getting added to HR case activity stream but not added in top manage attachments. Why its happening?

 

preethigovi_0-1751541522213.png

 

 

preethigovi_1-1751541535019.png

 

3 REPLIES 3

preethigovi
Tera Contributor
(function execute() {
var response = '';
var gr = new GlideRecord(vaVars.caseTable);

if (gr.get(vaVars.sysID)) {
var attachmentID = vaInputs.attachment ? vaInputs.attachment.getValue() : null;

if (attachmentID) {
if (gr.state == '24' || gr.state == '20') {
gr.state = '18'; // Reopen
}
gr.update();
vaSystem.attachToRecord(attachmentID, vaVars.caseTable, vaVars.sysID);
response = gs.getMessage("Your attachment has been added to the case.");
} else {
response = gs.getMessage("No attachment was provided.");
}
} else {
response = gs.getMessage("I couldn't find the record.");
}

return response;
})()

@preethigovi 

are you accepting file from user in VA topic?

is this behaving the same for admin and non-admin?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes from VA topic and its happening same for admins