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 / Power Automate / Problem with expression
Power Automate
Unanswered

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

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

    @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

    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

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

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard