Forum Discussion

diegostamato's avatar
diegostamato
Copper Contributor
Nov 13, 2024

Help with Conditional Logic for Keyword Detection in Copilot Studio

Hi everyone,

I'm working on a project in Copilot Studio and need some help with setting up conditional logic to detect keywords in user questions. Specifically, I want the system to respond differently when a question contains certain keywords, such as "FORD".

Here’s what I’m aiming to do:

  1. When a question includes the keyword "ford", I want to activate a specific set of knowledge resources or responses.
  2. If the question does not contain this keyword, I want it to trigger a different response path.

I've tried using functions like contains and IndexOf, but Copilot Studio doesn’t seem to recognize them. I’m looking for a way to implement this logic or an alternative approach to achieve similar results.

Is there a built-in function in Copilot Studio that allows checking for keyword presence in a string? Or are there any workarounds for implementing this type of keyword-based branching?

Any help or guidance would be greatly appreciated. Thank you!

4 Replies

  • dhendry's avatar
    dhendry
    Copper Contributor

     

    diegostamatoyou are best to use the 'change to formula' option by clicking on the '...' if the condition action.

     

    You can then use a formula similar to: Find("microsoft 365 e1", Lower(Topic.Var2)) > 0

  • HelloBenTeoh's avatar
    HelloBenTeoh
    Bronze Contributor

    Hey, I'm interested to know why you wouldn't be using Topics for your branching?

    • gatorwally7's avatar
      gatorwally7
      Copper Contributor

      Hi Ben. Just checking - Is your question directed towards Diegostamato?

  • gatorwally7's avatar
    gatorwally7
    Copper Contributor

    I have special VBA programming in Excel that looks for keywords - as many as you want - and in whatever columns you need. When it identifies keywords from your custom list, it records each keyword hit in a new column cell for analyzing. I can picture this working well for checking your programming and/or accuracy of your results. If you are interested in trying this, let me know. 

Resources