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 / Power Automate / Using if(contains) sta...
Power Automate
Answered

Using if(contains) statement in update item.

(0) ShareShare
ReportReport
Posted on by 80

Hello,

 

I am still learning this correct formatting and syntax for this system. I have a list with multiple columns and shown. I would like to add a Role column that updates based on the class that was selected. My current flow works for the function in the Totals for class, so it is likely how the If statement is written. I get an error message about the number of characters.

Any help is appreciated. Thank you.

list.jpg

flow update.jpgedited to add a better picture of If statement.

 

if statement.jpg

Categories:
I have the same question (0)
  • tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    Hello @ML147243 ,

    the if(...) should be entered as an expression, not as a string.

  • ML147243 Profile Picture
    80 on at

    @tom_riha Hi Thanks,

    Yes, I have tried to enter it as an expression and I get that the expression is invalid. 

  • Verified answer
    tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    My guess would be that you're missing one or more closing brackets. Try to put the whole expression in some code editor, e.g. 'Visual Studio Code' to check if every opening bracket has also a closing bracket.

  • ML147243 Profile Picture
    80 on at

    So it was that I was using " instead of ' . The flow isn't working though, I tried changing class to class value but it still is not working. 

  • ML147243 Profile Picture
    80 on at

    after some tweaking, this was what worked,

     

    if(contains(triggerBody()?['Class/Value'],'EDM RN'),'RN',

    if(contains(triggerBody()?['Class/Value'],'Tech'),'CNA',

    if(contains(triggerBody()?['Class/Value'],'CNA'),'CNA',

    if(contains(triggerBody()?['Class/Value'],'HUC'),'HUC',

    if(contains(triggerBody()?['Class/Value'],'SIS RN'),'RN',

    if(contains(triggerBody()?['Class/Value'],'RN'),'RN',

    if(contains(triggerBody()?['Class/Value'],'HF'),'RN',

    if(contains(triggerBody()?['Class/Value'],'student'),'SN',

    if(contains(triggerBody()?['Class/Value'],'SCM RN'),'RN',

    If(contains(triggerBody()?['Class/Value'],'Athena'),'HFMG','other'))))))))))

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 124 Super User 2026 Season 1

#2
Ellis Karim Profile Picture

Ellis Karim 52 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 50

Last 30 days Overall leaderboard