Virtual Agent to check logged in user Start date

MR1
Tera Contributor

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

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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

@MR1 

then did you debug the above script by adding gs.info()

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader