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.

Issue with setting context variable during live agent initialization

Riyaz Ali Moham
Mega Guru

Hi All,

I've created a context variable and was trying to set the value in it while initiating the live agent so that I can use the context variable value in the AWAs service channels conditions, but I'm facing an issue here

Context variable:
Name: liveAgentFromHex
Script Variable Name: LiveAgent_liveAgentFromHex

Code written in script action utility of Live Agent VA topic:

(function execute() {
vaVars.LiveAgent_liveAgentFromHex='Yes';
gs.log("LAH1: "+vaVars.LiveAgent_liveAgentFromHex);
vaSystem.connectToAgent();
gs.log("LAH2: "+vaVars.LiveAgent_liveAgentFromHex);
})()

Variables tab while testing Live Agent VA topic:
Showing value of LiveAgent_liveAgentFromHex as -(NULL)

Logs tab while testing Live Agent VA topic:
LAH1: Yes
LAH2: Yes

Could someone assist me in understanding why the value isn't being set to the context variable despite being captured in the logs?
1 REPLY 1

Kumar Premankit
Tera Expert

Though information provided seems not enough I might suggest few things.

1- Look at the scope and how you reference your script include. 

2- Print the various objects of vaVars and observe what values are being set. 

 

I would love to understand what you are trying to do. I know script can be done to make decision but why not update the Topic to do same operation.