cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JBloot
Frequent Visitor

Comparing Email Subject to Sharepoint List

I am trying to make a flow filter emails based on a serial number found in the subject line of an email.

 

I have the intended recipients located in a SharePoint list with their respective serial numbers. I want to forward the email if the subject contains a serial number(SN) found in the list. If no "owner" can be found for that SN, then I want to send an email to myself that an owner is missing.

 

I built a flow identical to the one found in this solution: Solved: Check if an email subject matches a SharePoint Lis... - Power Platform Community (microsoft.... It works just fine for the "YES" condition, but I found that for the "NO" condition, because it is looping through the whole "get item" list I get a "no owner found" email for every row in my contact list (which can be a lot of spam).

 

JBloot_0-1649957908609.png

Each SN is unique, so ideally I want this to only loop once and send a single email for either the forward email, or the notification that there is no owner.

 

Thanks in advance for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
takolota
Super User
Super User

@JBloot 

What’s the pattern of the serial number in the Subject line?

 

I’m thinking the simplest solution would be to parse the number out of the subject line so you can just use the Odata filter on the Get items where ListSN eq SubjectSN

View solution in original post

3 REPLIES 3
takolota
Super User
Super User

@JBloot 

What’s the pattern of the serial number in the Subject line?

 

I’m thinking the simplest solution would be to parse the number out of the subject line so you can just use the Odata filter on the Get items where ListSN eq SubjectSN

JBloot
Frequent Visitor

An example subject format would be:
"IR - Asset ID : ###### Model : ###### SN : ######"

 

Asset IDs, Model #s can very in length... maybe I can parse from the end of the subject string to always get the fixed amount of SN characters? @takolota 

takolota
Super User
Super User

@JBloot 
Try

trim(

split(Subject, ‘:’)?[3]
)

 

That should split that up my the colons, then the ?[3] tells it which one you want starting from 0.

You could also use 

trim(

last(

split(Subject, ‘:’)

)

)

If it is always the last value.

 

Then if the list column is a number column, add a int( ) function before the trim.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,262)