Static choice input component usage in Virtual agent for populating select box variables

Firas Kh
Tera Expert

Hi Experts,

while implementing the Virtual agent topics using some of oob topics and cloning the others, opened a topic for hr service to give the user an ability to open hr cases from the virtual agent for this hr service. so during the nodes adding i required to put a step node of selecting checkboxes like in the backend variables, where there for the same record producer i did a checkboxes, so to make the same on the virtual agent, i found the Static choice input to be the most close solution so added it and added value to the same step to choose on of them. then i need to populate the value that was selected inside the hr case backend and to select there the checkbox of the same option that was selected in the virtual agent step. so i tried to put a script action utility to take the selected option from the node above then to check if the value1 is selected then to give to a new Boolean variable = true then at updating the hr case to give the hr case field the same value of the Boolean variable. but this solution did not work. attaching photos hoping someone did the same requirement. thanks

1 REPLY 1

Daniel Sampaio
Tera Expert

Hello,
You are receiving a static choice that will be stored on vaInputs.what_is_your_request_type_
When you do the validation with the IF you don't need to get value just use the variable + I recomend you to use vaVars."variablename" to store script values: 
*------------------------------
(function execute() {
if (vaInputs.what_is_your_request_type_ == 'test1')
vaVars.something = true; -> 1 equal saves the value, 2 verifies if it's equal
else if (vaInputs.what_is_your_request_type_== 'test2')
vaVars.something2 = true; -> same as before
})();
          *------------------------

  • = assigns a value.

  • == or === compares values (=== also checks type)
    *------------------------------------

Let me know if this helped.