Virtual Agent Script Action being skipped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:05 PM
Hi everyone,
I'm trying to develop an Incident topic in Virtual Agent Designer. Within, I have several selections for Category, and each Category has specific selections for Subcategory. I am using Script variables as basically scratchpad variables, and then updating those Script variables within an Script Action. Unfortunately, I am seeing that the Script Action is completely being skipped (via gs.info, gs.warn, logs, etc.) Why would it be skipped?
Script Action code:
(function execute() {
gs.info('VA Action reached');
if(vaInputs.hardware.getValue() != ''){
vaVars.vaSubcategory = vaInputs.hardware.getDisplayValue();
gs.info('Subcat is: ' + vaVars.vaSubcategory);
}
if(vaInputs.mobile_device.getValue() != ''){
vaVars.vaSubcategory = vaInputs.mobile_device.getDisplayValue();
}
if(vaInputs.conference_room_equipment.getValue() != ''){
vaVars.vaSubcategory = vaInputs.conference_room_equipment.getDisplayValue();
}
if(vaInputs.application_issue_type.getValue() != ''){
vaVars.vaSubcategory = vaInputs.application_issue_type.getDisplayValue();
vaVars.vaApplication = vaInputs.application_name.getDisplayValue();
/*
if(vaVars.vaApplication = 'SharePoint'){
}
*/
}
if(vaInputs.vending_machine.getValue() != ''){
vaVars.vaSubcategory = vaInputs.vending_machine.getDisplayValue();
}
if(vaInputs.telecom.getValue() != ''){
vaVars.vaSubcategory = vaInputs.telecom_items.getDisplayValue();
}
if(vaInputs.storage_data_fileshare.getValue() != ''){
vaVars.vaSubcategory = vaInputs.storage_data_fileshare.getDisplayValue();
}
if(vaInputs.security.getValue() != ''){
vaVars.vaSubcategory = vaInputs.security.getDisplayValue();
}
if(vaInputs.printer.getValue() != ''){
vaVars.vaSubcategory = vaInputs.printer.getDisplayValue();
}
if(vaInputs.microsoft_teams.getValue() != ''){
vaVars.vaSubcategory = vaInputs.microsoft_teams.getDisplayValue();
}
if(vaInputs.connectivity.getValue() != ''){
vaVars.vaSubcategory = vaInputs.connectivity.getDisplayValue();
}
vaVars.vaCategory = vaInputs.category.getDefaultDisplayValue();
})()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:16 PM - edited 06-28-2023 12:17 PM
Hi there,
Any errors in the logging perhaps? And how are you testing, using preview or actually publishing and triggering the topic?
I did notice in your code this, which I did see in documentation though never tried myself:
getDefaultDisplayValue
Does that work?
Kind regards,
Mark
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-28-2023 01:07 PM
Hi @Daniel Brown2 ,
Hope you are doing fine.
To troubleshoot this issue, there could be a few possible reasons why the Script Action is being skipped:
Double-check the condition statements within the Script Action to ensure that they are evaluating correctly. Verify that the conditions are accurately capturing the expected values from the various selections for Category and Subcategory.
Examine the logic flow in the Script Action carefully. Make sure there are no conflicting conditions or conflicting assignments to the vaVars.vaSubcategory variable. Review each condition and ensure that only one assignment is executed per execution flow.
Check for any unintended behaviors related to the vaVars.vaSubcategory variable. Confirm that it is properly declared and initialized before the Script Action is executed. Ensure that there are no conflicting assignments or manipulations of this variable elsewhere in your code.
Regards,
Riya Verma