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 / Compose action errorin...
Power Automate
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? 

 

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    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

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @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.

     

     

  • TonyD7 Profile Picture
    4 on at

    @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. 

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard