web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / PowerFx formula error:...
Copilot Studio
Answered

PowerFx formula error: Identifier not recognised

(0) ShareShare
ReportReport
Posted on by 38

Hi guys, I have a question. I'm trying to add a conditional node here with the following expectation: Whenever the last message/trigger message has the words "access" OR "license" then lead the user to a certain path on the workflow. This is the code I've been getting on preview:

Text(Topic.Message).contains('license') || Text(Topic.Message).contains('access')
However, it's been giving me issues. I tried a workaround with the IF statement however, it doesn't truly work for my kind of logic. Is there a different approach I can maybe look into?
 
Siziwe_0-1697619452237.png

 

Categories:
I have the same question (0)
  • Verified answer
    HenryJammes Profile Picture
    Microsoft Employee on at

    Hi @Siziwe ,

     

    I have the below example that you can reuse to meet your objective.

    I actually use the LookUp formula in Power Fx.

     

    I first setup a table variable with my list of keywords:

     

    [
        { Keyword: "Access" },
        { Keyword: "License" },
    ]

    I then check if the user question contains the keyword or not (in lowercase):

     

    !IsBlank(
        LookUp(
            Topic.Keywords,
            Lower(Keyword) in Lower(Topic.Question)
        )
    )

     

    HenryJammes_0-1697623231160.png

     

    You can reproduce this by pasting the below YAML in a new topic:

     

    kind: AdaptiveDialog
    beginDialog:
     kind: OnRecognizedIntent
     id: main
     intent:
     displayName: Keyword Condition
     triggerQueries:
     - Keyword condition
    
     actions:
     - kind: Question
     id: question_7REwVb
     interruptionPolicy:
     allowInterruption: true
    
     variable: init:Topic.Question
     prompt: What is your question?
     entity: StringPrebuiltEntity
    
     - kind: SetVariable
     id: setVariable_Xi46xv
     variable: Topic.Keywords
     value: |-
     =[
     { Keyword: "Access" },
     { Keyword: "License" },
     ]
    
     - kind: SetVariable
     id: setVariable_5QF2kS
     variable: Topic.ContainsKeyword
     value: |-
     =!IsBlank(
     LookUp(
     Topic.Keywords, 
     Lower(Keyword) in Lower(Topic.Question)
     )
     )
    
     - kind: ConditionGroup
     id: conditionGroup_ZXXmnq
     conditions:
     - id: conditionItem_DVxsJB
     condition: =Topic.ContainsKeyword = true
     actions:
     - kind: SendActivity
     id: sendActivity_dS0W20
     activity: Your question contained a matching keyword.
    
     elseActions:
     - kind: SendActivity
     id: sendActivity_KB9kMN
     activity: Your question didn't contain a matching keyword.

     

    Let me know if that helps

  • Siziwe Profile Picture
    38 on at

    Hi @HenryJammes  I'll test this out and get back with some feedback. Thank you so much.

  • Siziwe Profile Picture
    38 on at

    Hi @HenryJammes,

    The solutions worked. Thank you for your support. 
    A question from my end - is there a resource guide you can direct me to learn more about these formulas or the LookUp function will help a lot? 

  • HenryJammes Profile Picture
    Microsoft Employee on at

    There is the Power Fx formula language documentation or a few examples that apply to PVA here: https://learn.microsoft.com/en-us/power-virtual-agents/advanced-power-fx

  • Siziwe Profile Picture
    38 on at

    Thanks @HenryJammes !

  • HenryJammes Profile Picture
    Microsoft Employee on at

    @Siziwe wrote:

    Thanks @HenryJammes !


    No worries, keep them coming - we're looking at documenting as many examples and "how to" as possible to ease adoption.

  • debr92 Profile Picture
    2 on at

    Hello @HenryJammes , thanks for this. I am trying out something similar and this has helped me. Next thing I am looking for is something like if the user input has license in his input, it needs to call Flow1, if it has "Access" then flow 2 otherwise some default flow. Something like "I want my license renewed" - should trigger flow 1 identifying keyword as license. how can I do that?

  • adilei Profile Picture
    Microsoft Employee on at

    Why not use trigger phrases/entities for that? 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 256

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 208 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 198

Last 30 days Overall leaderboard