Skip to main content

Notifications

Community site session details

Community site session details

Session Id : JeYVNeXFxiw2D9YNhrmVc4
Power Automate - Building Flows
Answered

Array index out of bounds

Like (0) ShareShare
ReportReport
Posted on 28 Jan 2023 03:11:28 by 84

I have successfully set up a flow with HTML to text but I am unable to pull the first name from a line in an email. 

Second array reads "Please see the PCA details below for Jane Doe."

replace(trim(split(body('Filter_array')[1], ' ')[5]), '.', '') 

The above expression pulls the last name from the array.

Trim(split(body('Filter_array')[1], ' ')[7])

The above expression does not pull Jane from the array though. "cannot be evaluated because array index '7' is outside bounds (0, 6) of array. "

 

Any help is appreciated. 

  • HEEEEEEELP Profile Picture
    4 on 22 May 2023 at 16:43:44
    Re: Array index out of bounds

    <<Post deleted, then modified again.>>

     

    After following the steps in the thread, I'm still not getting the values separated from the titles.

     

    For reference, here's my output of the html to text (some info changed to protect the innocent:)

    "From: 3Test Grant <email>
    --
    This email was sent from a contact form on my org name
    (https://abc.com)
    Application Type: Hosting Grant
    Payee Name: 3Test Grant
    Address: an address
    Tel No: a number
    Email: it@ovca.com
    ---Hosting Grant Information ---
    Hosting Requesting Club: ggrrggr
    Hosting Grant Type: Development Clinic
    Clinic Type: ALTC
    Clinic Start Date: 2023-05-23
    No. of Attendees: 6 to 10
    Hosting Event Name:
    Hosting Event Start Date: 
    Hosting Amt Requested:

     

    This is what I get after the Filter Array:

    {
        "body": [
            "From: 3Test Grant <it@ovca.com>",
            "--",
            "This email was sent from a contact form on my org",
            "(https://abc.com)",
            "Application Type: Hosting Grant",
            "Payee Name: 3Test Grant",
            "Address: address",
            "Tel No: number",
            "Email: email",
            "---Hosting Grant Information ---",
            "Hosting Requesting Club: ggrrggr",
            "Hosting Grant Type: Development Clinic",
            "Clinic Type: ALTC",
            "Clinic Start Date: 2023-05-23",
            "No. of Attendees: 6 to 10",
            "Hosting Event Name:",
            "Hosting Event Start Date: 2023-05-24",
            "Hosting Amt Requested:",
     
    Any ideas?  I have the Select Map set to text, and have the filter array set to where item is not equal to blank.
  • DH2023 Profile Picture
    84 on 29 Jan 2023 at 16:41:21
    Re: Array index out of bounds

    After testing these with a few hire hires, I ran into an issue. Some new hire emails come through with the middle name included in the Name field. 

     

    The expression 

    trim(slice(body('Parse_JSON')?['Name'], indexOf(body('Parse_JSON')?['Name'], ' ')))

    Doesn't seem to separate just the last name from this field. 

     

    Best regards,

  • DH2023 Profile Picture
    84 on 29 Jan 2023 at 15:07:36
    Re: Array index out of bounds

    This has been very informational. Thank you so much for all of the assistance! 

     

    Last question that I have, do you recommend any courses or training materials to expand my knowledge on these types or workflows? I will be trying to incorporate these types of flows into our termination process at my company as well very soon. 

     

    Best regards,

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 29 Jan 2023 at 14:49:16
    Re: Array index out of bounds

    Extracting the Supervisor First Name and Last Name would be the same expressions used for the other First Name and Last Name but using the Supervisor property instead of the Name property.

  • DH2023 Profile Picture
    84 on 29 Jan 2023 at 14:35:06
    Re: Array index out of bounds

    That was it! It appears that the flow is now working and I am able to pull the dynamic content needed.

     

    This will be extremely useful in my day to day operations. 

     

    Do you have any suggestions for separating the supervisors First and Last name?  

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 29 Jan 2023 at 14:04:40
    Re: Array index out of bounds

    Getting there. Can you check your condition in your Filter query? It should be is not equal to.

     

    grantjenkins_0-1675001068751.png

     

  • DH2023 Profile Picture
    84 on 29 Jan 2023 at 13:45:02
    Re: Array index out of bounds

    Hello. Yes, this is the email that I used in and how our new hire personal change authorization emails are received. My select was not set to Text mode. After doing so, I am still not getting the proper out put it appears. 

    DH2023_0-1674999881787.png

     

    DH2023_1-1674999894450.png

     

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 29 Jan 2023 at 13:26:25
    Re: Array index out of bounds

    And in your Select, did you set Map to Text mode?

     

    grantjenkins_1-1674998771965.png

     

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 29 Jan 2023 at 13:23:33
    Re: Array index out of bounds

    I copy/pasted the email sample you gave me. Is that what you used?

     

    See the email I sent that was the trigger for the flow.

     

    grantjenkins_0-1674998601159.png

     

  • DH2023 Profile Picture
    84 on 29 Jan 2023 at 13:19:13
    Re: Array index out of bounds

    DH2023_1-1674998343595.png

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

Overall leaderboard