cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jbuis
Level: Powered On

Searching e-mail subject for several strings

Okay, I'll be honest here-- not sure how to write this one. I need to search an e-mail subject for three distinct pieces of data. The e-mail subject will contain something like:

Item1: ABC, Item2: DEF, Item3: GHI

 

I need to watch a Shared Inbox for new e-mails. When one arrives, I need to pieces of data parsed out from the values of Item1, Item2, Item3, if you will and then spit it out to some Teams messages if the values contain certain information. I have the Teams messages and such figured out from previous Flows. Just not sure how I can go about getting the pieces of information. I know how to search for one, but don't know how different it is. Thoughts are appreciated!

 

The Teams message will need to read something like this:

 

Item1: ABC

Item2: DEF

Item3: GHI

Sorry for the question with no display of attempts-- I usually have a starting base. I'm probably overthinking it.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Searching e-mail subject for several strings

ok, so here's what I did:

split(replace(outputs('SampleData'),' ',''),',')
 
So, first this gets rid of any spaces, then it splits the string into an array on the comma.  You can either use a Compose action with that expression, and then set an Array variable to the output, or drop that expression in the Value part of the Initialize variable.
 
From there, you can probably run a normal condition and do the things you've already done.
 
Keep us posted.
 
-Ed-
 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Searching e-mail subject for several strings

@jbuis 

Hi there. A couple of questions before we dig in...

  • Will the subject always have three items?
  • Will they always be separated by a colon? ':'
  • Will the criteria you mentioned apply to ALL three items?  Or will there be a criteria for Item 1, a different criteria for item 2, and so on?
  • What happens if some of the items meet the criteria, but one or two don't?

Check out the Split() function, as I think that will be helpful in parsing out the subject if the data is consistent.  Here's a video:

 

Hope that helps.  Keep us posted.

-Ed-

 

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

jbuis
Level: Powered On

Re: Searching e-mail subject for several strings

Thank you for the reply! The three items will always be in the subject and will always be listed like this: Item1: variable, Item2: variable2, Item3: variable3

 

Split is what I have used previously for a single item. Thanks again!!

Super User
Super User

Re: Searching e-mail subject for several strings

ok, so here's what I did:

split(replace(outputs('SampleData'),' ',''),',')
 
So, first this gets rid of any spaces, then it splits the string into an array on the comma.  You can either use a Compose action with that expression, and then set an Array variable to the output, or drop that expression in the Value part of the Initialize variable.
 
From there, you can probably run a normal condition and do the things you've already done.
 
Keep us posted.
 
-Ed-
 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

jbuis
Level: Powered On

Re: Searching e-mail subject for several strings

@edgonzales You're a freaking genius. I will take this and run with it. I will probably further it with getting the [0], [1], [2] pieces out it as some new requirements rolled my way. This gets me exactly where I need to be to think through the rest of the solution. Thanks every so much, mate! Cheers!!!!!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,869)