Getting error vaVars not defined in VA Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 08:39 AM
Hi All,
I am writing this script,
(function execute() {
// Fix as part of STRY0077174
if (gs.nil(vaContext.liveagent_application)) {
// Split user criteria string to get array output
var userCriteria = gs.getProperty('va.hr.user_criteria').split(',');
// returns true if at least one user criteria matches to the current logged in user
var userMatches = sn_uc.UserCriteriaLoader.userMatches(gs.getUserID(), userCriteria);
if ((userMatches) && (vaVars.LiveAgent_BusinessService != 'impact'))
return true;
}
else if ((vaContext.liveagent_application == 'hr')&& (vaVars.LiveAgent_BusinessService != 'impact'))
return true;
})()
And when the topic is running in the logs I can see the Error as: vaVars is not defined, but in topic in variables I can see the LiveAgent_BusinessService.
Please assist.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 09:40 AM
Hello @Community Alums , did you find any solution for this situation or a Workaround?
I am facing the same. situation. Additionally, when I print it in a text field in the topic flow, the vaVars variable has data, it looks the problem is when we try to use it in the conditions of the topic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 10:49 AM
Hi @Community Alums,
Have you added your variable under Script Variables? If not please add the same.
Let me know what happens.
If this post helps you in any way, please mark it helpful 👍 and accept the solution.
Thanks,
Kavita Bhojane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 08:55 PM
HI @Community Alums ,
I trust you are doing great.
As a safeguard, you can assign a default value to vaVars if it's not defined. For example:
var vaVars = vaVars || {}; // This sets vaVars to an empty object if it's not already defined
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
