How do I remove a topic from MS Teams Virtual Agent bot, but leave it visible on portals? ***HELP NEEDED***

Still Learning
Kilo Sage

I have a requirement to restrict VA Topics in the ME Teams Now Agent app to only show CSM topics. Today, all topics appear in the list of available topics. How do I restrict the list of topics in MS Teams without impacting its visibility on portals? 

1 ACCEPTED SOLUTION

I just added a reply that perhaps could explain your issue...

Are you still using the Now Virtual Agent Teams app? If so, you will need to use vaContext.deviceType == 'teams' (lowercase t).

While you're at it though, add an OR condition or a .toLowerCase() so this condition doesn't break when you move to the new Teams app (ServiceNow for Teams) which uses a capital T "Teams" deviceType.

View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Hi @Tonya ,

In the topic condition script, use “vaContext.devicetype == Teams” as a condition to exclude topics from the MS Teams channel. 

{ if(vaContext.deviceType === 'Teams'){
return false;
}
 
Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Hello Sandeep,

Thank you so much for your reply. I'm a very new developer so I have a question regarding your answer.  I edited the current script for one of the topics, but it still shows up in Teams so I'm thinking I did it wrong.  Can you please tell me where I need to make the update, or how it should be edited so that it works correctly? My script is below:

 

(function execute() {
    var answer = false;
    if(vaContext.portal != 'csm' || !vaContext.portal){
        answer=true;
    }
    vaContext.deviceType == Teams;
   if(vaContext.deviceType === 'Teams'){
       return false;
   }

    return answer;
})()

 

If you're returning both true (via 'answer') and false, how would it know? 

That wouldn't happen though - when you return false, it'll break out of the function and just return true, rendering 'answer' irrelevant.

Not saying that that's good code, but line 6, vaContext.deviceType == Teams; is the only technical issue I can tell.

I did ignore that myself, assuming it was a typo because Tonya does have better code in a different post.