Virtual Agent - Create incident- how to set caller to logged in user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:25 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 11:14 AM
And when executing your code, there's a very clear message written in the system logs:
com.glide.script.RhinoEcmaError: "problemGR" is not defined.
Task.9582a81e1b4811101ab0fcc6cc4bcb40 : Line(8) column(0)
Looking more closer to your script...
problemGr versus problemGR. A typo!
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 11:35 AM
Thanks Mark - I fixed the typo, thanks for noticing that!
However, I have tried these 4 things and am still getting an error: in the screenshot, that's the only error I see when I view the logs. Any ideas? Thanks again for your help
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 11:45 AM
This is the full code I successfully tested with:
(function execute() {
var problemGr = new GlideRecordSecure('incident');
problemGr.initialize();
problemGr.short_description = 'Something';
problemGr.caller_id = vaInputs.user;
vaVars.create_problem = problemGr.insert();
return vaVars.create_problem;
})();
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 11:53 AM
Mark,
That's perfect.. I really appreciate the help!! Lots of new things to learn!!! Thank you again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 12:07 PM
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
