- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 05:10 AM
Hi Community,
I’m trying to build a Virtual Agent topic using VA Designer (Xanadu version) that helps users retrieve incident records created or updated in a specific timeframe.
Here’s what I want the bot to do:
Ask the user how far back they want to look (e.g., last 5 days, last 10 days, last 15 days, or let them pick a custom date)
Based on their selection, query the incident table and filter records using sys_created_on or sys_updated_on
Then display the matching records to the user—ideally in a table or cards inside the chat
I'm starting this from scratch and could use some guidance on how to set this up in VA Designer. Specifically:
How do I structure the conversation flow?
How do I store user inputs (days or dates)?
What’s the best way to use GlideRecord in Scripted Actions for this?
And how do I present the results in a clean, interactive way?
Any help or examples would be amazing. Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 06:43 AM
Hello @SK07 ,
Just got some time to replicate your use case and wanted to share a simple working example I tried in my PDI—it should help you get started quickly.
I kept this in a separate topic and structured it in two main steps:
🔹 Step 1 – Ask user for timeframe
Create a text question (open-ended input) like:
"How many days back do you want to check for incidents?"
-
Variable Name: "get_days_range"
-
Input Format: Text (you can later enhance it to use quick replies like 5, 10, 15, etc.)
🔹 Step 2 – Scripted Table Response
Use the "Table" response type to display incidents in a clean tabular format.
Here’s the script I used inside the table’s Populate with Script section:
(function execute(table) {
var daysRange = parseInt(vaInputs.get_days_range);
var userId = gs.getUserID(); // Logged-in user
// Relative date filter (X days ago)
var relativeDate = '@dayofweek@ago@' + daysRange;
// Encoded query to fetch created or updated incidents
var encodedQuery = 'caller_id=' + userId +
'^NQsys_created_onONRELATIVEGE' + relativeDate +
'^ORsys_updated_onONRELATIVEGE' + relativeDate;
var gr = new GlideRecordSecure(table);
gr.addEncodedQuery(encodedQuery);
gr.query();
return gr;
})(table);
In the Columns section of the table, I displayed:
-
Number
-
Assigned to
-
State
Feel free to adjust based on your needs.
Final Output:
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2025 01:06 AM
Hi @Aniket Chavan ,
Thanks so much for your help! I really appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2025 01:30 AM
@SK07 Glad to know it helped and resolved your query!
Thanks a lot for marking my response as helpful and accepting the solution too 😉