Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Compose action erroring out in random sections

(0) ShareShare
ReportReport
Posted on by 4

Hey there,

 

I am creating a flow to have data within an outlook email template flow into a Smartsheet. During testing, the compose actions were working as expected, but when set to production it started causing a substring length error. Here is an example of the compose function created:

 

trim(substring(outputs('Convert_Email_into_Text')?['body'], outputs('Pulls_Beginning_Index_of_Interview_Type'), sub(indexOf(outputs('Convert_Email_into_Text')?['body'], 'Interview Location:'), outputs('Pulls_Beginning_Index_of_Interview_Type'))))
 
Since the emails that arrive are in the same template, the idea was to use Indexes to pull the necessary data. The weird part is that this will work for some emails, and not others. The error jumps to different compose actions, essentially the same as above just using different actions. Anyone have thoughts of why or a better solution? 

 

  • TonyD7 Profile Picture
    4 on at
    Re: Compose action erroring out in random sections

    @abm @ScottShearer ,

     

    Thank you for both responding. Due to business data on the flow results, I can't show it directly, but hoping to explain it better this time. I went and separated my embedded functions into their own Compose actions to find where the problem is, and I think I found the issue, but am not 100% certain on the cause, just a hunch. 

    The flow starts when an email arrives in a shared inbox (this step works fine). The next action is to convert the HTML email into text. From there I have a scope with Compose actions within, and basically I am finding indexes of where certain text strings are located, so I can extract the contents. Here's the template that is used every time, I am basically trying to pull the 'X' values of a handful of the below:

     

    TonyD7_0-1632255588404.png


    But what I have noticed is that some of the Indexes, let's say for when I search for "Cost Center:" using indexOf(outputs('Convert_Email_Into_Text')?['body'], "Cost Center:"), it returns a -1. The pattern I found as the common issue is that when an email is put through the Converter action, some of these fields skip lines, see below for an example of the "Output" of a specific email after going through the convertor action:

     

    TonyD7_1-1632255951879.png

     

    I highlighted "Job Function" and "Interview Type" as examples of these line skips. In this specific occurance, the indexes returned -1 for locating "Job Function:" and "Interview type:". Is there an action to not have PA format the output as such? Any ideas would be helpful. 

  • ScottShearer Profile Picture
    25,228 Most Valuable Professional on at
    Re: Compose action erroring out in random sections

    @TonyD7 

    It's hard to know exactly what is going on without seeing that actual error.  That said, I am reasonably sure that you could simply your Flow and likely eliminate your error if you were to use one or more split() expressions to parse out your text rather than trying to use absolute positions.

    If you can provide an example of the email text and what you want to extract, I will provide an example.

     

     

  • abm abm Profile Picture
    32,492 Most Valuable Professional on at
    Re: Compose action erroring out in random sections

    Hi @TonyD7 

     

    The error is getting due to inconsistent data. Check the run history and see each values. That is quite a long expression you using. You could break into different compose action steps so that it is easy to debug which step exactly it is failing and why? Compare with your test data vs the production data. Without seeing the full flow and data its difficult to give you an exact answer for this.

     

    Thanks

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1