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 10:28 AM
Hi,
Can you try using this line instead?
problemGR.setValue("caller_id", gs.getUserID());
Alternatively, you may need to use:
problemGR.setValue("caller_id", vaInputs.user.sys_id);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:55 AM
Hi, thanks for the reply. I tried that line and I'm getting " I'm having technical issues and won't be able to continue this conversation." as a response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 11:15 AM
See my comment about the typo in problemGr versus problemGR.
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:07 AM
Hi there,
Just curious, what's the reason for not using the Record Action utility, and instead using the Script Action utility?
Anyway, looking at your script:
var problemGr = newGlideRecordSecure('incident');
A space is missing.
problemGR.setValue("caller_id", caller);
What is caller? This will never work. It should be something like vaInputs.user, or gs.getUserID(), etc..
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
