Virtual Agent Context Variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 04:06 AM
Hi there,
I'm trying to determine the current portal URL by using a context variable, however, the variable always return undefined and I cannot seem to figure out why. Any help would be greatly appreciated!
Context Variable (I have removed answer and tried, remove 'getSession' and tried but no luck) is the attachment.
Condition script on virtual agent topic:
gs.log("Context plswork: " + vaContext.portalCheck, "BenTest");
if(vaContext.plsWork.includes("locker"))
return false;
else
return true;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 06:14 AM
Ah oke. Then vaContext will for sure not work.
Kind regards,
Mark
---
LinkedIn
Community article 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
‎01-15-2020 06:23 AM
Ahhh... Do you know of anyway that could work this out? Tried doing below as well as a range of different combinations but no luck...
if(gs.getSession().getUrlOnStack('xxxx'))
return true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 10:11 PM
Hello benm,
Were you able get the url parameter in the Virtual agent script ? Facing the same issue.
Regards,
Anindya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 01:46 AM
Hi anindya_11,
Unfortunately not. We also raised a HI ticket but was met with little luck..
Thanks,
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2022 08:13 PM
I found this article on the community that might help answer this question.
Provides the Portal suffix. This Context variables only works instantly when using Service Portal Agent Chat Configuration. If using legacy methods (like embedding the Service Portal widget to the header or footer), this would only work when adding sysparm_portal to the URL.
Example output: "sp"