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

Notifications

Announcements

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
    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
    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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 251 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 201 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard