Virtual Agent to check logged in user Start date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2022 10:36 AM
Hi All,
I need assistance verifying the "start date" of the individual using the virtual agent chat. Change the topic if the user is new and has a start date of less than a week (the Virtual Agent topic).
I think we can validate via the "greeting" topic in some way. Please assist me.
Thanks
- Labels:
-
Agent Workspace
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2022 10:18 PM
Hi,
greeting topic can be customized but remember it's used across all topics at the start of conversation.
Why not do this
1) in your custom topic have a script to check what's the date for logged in user and then take necessary actions
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 07:10 AM
Yes Ankur, I am aware of it.
Basically whenever user start date is less than 1 week then only he should be routed to another topic.
I used this script action in the Greeting designer topic.
(function execute() {
vaSystem.switchTopic('validate Start date');
})()
In that validate start date topic, I am using this script
(function execute() {
var gDate = new GlideDate();
var usrEncQuery ='u_effective_start_dateRELATIVELT@dayofweek@ahead@21^active=true';
var user = new GlideRecord('sys_user');
user.addEncodedQuery(usrEncQuery);
user.addQuery("sys_id",gs.getUserID());
user.query();
while(user.next());{
// if (user.next())
// if(vaInputs.user.u_start_date > gDate){
if(user.u_start_date > gDate){
answer = true;
}
}
})()
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 07:58 AM
then did you debug the above script by adding gs.info()
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader