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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Problem with expression

(0) ShareShare
ReportReport
Posted on by 109

Hi everyone, 

@edgonzales very kindly gave me the below as a solution to some problems I was having with my flow. Unfortunately it won't let me enter it! I'm getting an error saying 'The expression is invalid.' from the expressions tab. I'm sure it'll just be a typo like a comma or bracket in the wrong place, but I don't know enough to correct it. Can anyone help please, as Ed won't be up for 5 hours yet...! 😂

substring(items('Apply_to_each')?['name'],0,add(indexof(items('Apply_to_each')?'name'],last(split(items('Apply_to_each')?['name'],'.'))),-1))

I have the same question (0)
  • Krishna92 Profile Picture
    Microsoft Employee on at
    Re: Problem with expression

    @Magikmissy 

     

    I think the problem is with the indexof() function it accepts only two parameters and in the below formula you are trying to pass three parameters, indexof(items('Apply_to_each')?'name'],last(split(items('Apply_to_each')?['name'],'.')

     

    indexOf
    This function finds the index of a value within a given string case insensitively. This function requires 2 parameters: the string that contains the value and the value to search the index of.
    Function: indexOf(text, searchText)
     
    If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.
     
  • Verified answer
    Magikmissy Profile Picture
    109 on at
    Re: Problem with expression

    It was missing a bracket!

     

    Substring(items('Apply_to_each')?['name'],0,add(indexof(items('Apply_to_each')?['name'],last(split(items('Apply_to_each')?['name'],'.')) ),-1))

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard