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.

Virtual Agent - Create incident- how to set caller to logged in user?

Sandy7
Tera Expert

Hello,

I am setting up virtual agent and trying to do something pretty basic.. when an incident is created from VA, i want to set the Caller field on the incident to the logged in user. 

My code I am using in the create incident part of the flow in VA is: (don't mind the reference to problem, i copied the code: 

The incident is being created, but the caller is not. Can someone help please?


(function execute() {
var problemGr = newGlideRecordSecure('incident');
problemGr.initialize();

problemGr.short_description = vaInputs.short_description2;
problemGr.urgency = vaInputs.urgency1;
problemGR.setValue("caller_id", caller);
 
 
 
vaVars.create_problem = problemGr.insert();
return vaVars.create_problem;
})();

 

11 REPLIES 11

Glad it works.

Can you close this topic?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

If still running into an issue, do also look at the system logs. Not only the logs from the Virtual Agent Designer.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn