cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Extract date from email body

This is closely related to my post from 4 weeks ago. 

https://powerusers.microsoft.com/t5/Building-Flows/Extract-email-address-from-email-body-compose-wor... 

 

I set this flow up on a coworker's computer and it seemed to be running successfully until I found out that it is intermittently, but consistently, stumbling on extracting the date from this part of each incoming email: 

 

From: noreply@civicplus.com <noreply@civicplus.com>
Sent: Thursday, June 4, 2020 12:29 PM
To: Recyclingrefuse <recyclingrefuse@nowhere.gov>
Subject: Online Form Submittal: Request a Scheduled Collection

 

I'm using the following in a compose function to extract the date sent

trim(split(split(body('Html_to_text'),'Sent:')[1],'To:')[0])
 
This is the error: 

InvalidTemplate. Unable to process template language expressions in action 'Intake_Date' inputs at line '1' and column '2879': 'The template language expression 'trim(split(split(body('Html_to_text'),'Sent:')[1],'To:')[0])' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

 

This person get multiple emails throughout the day from these form submissions. Sometimes it fails on every other submission. Sometimes it runs successfully 3 or 4 times. Sometimes there are multiple failures. It makes no sense to me. 

 

I have this exact same flow set up on my computer and when I forwarded one of the failed emails to myself it worked. 

 

Why? What should I look for?

 

 

4 REPLIES 4
Highlighted
Community Support
Community Support

Hi @mapguymike ,

 

Does the flow would works some time and fail sometimes?

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Highlighted

Yes.

Highlighted

I found a workaround. I'm using utcNow() instead of trying to extract the date. This is acceptable for this purpose and in fact it is resulting in the same time stamp to the minute. As soon as the form is submitted this flow processes it within seconds. 

Highlighted

I'm having the same intermittent issue on a different item. 

 

This is the part of the HTMLtoText output

 

Type ofCollectionBulk (non-metal items)Please list the materials for pickup

 

Most of the time this works and sometimes it fails with this error:

Unable to process template language expressions in action 'Type_of_Collection' inputs at line '1' and column '2878': 'The template language expression 'trim(split(split(body('Html_to_text'),'Type of Collection')[1],'Please')[0])' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

 

I don't understand what it means when it says that array index 1 is outside bounds (0,0) of array when the exact same piece of html to text succeeds in other runs

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (14,018)