cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SylvieLet17
Level 8

Forward an email to a person in a sharepoint list based on email subject

Hi all

I need to forward an email based on a substring of the subject line to a few addresses depending on a SharePoint list.

The flow runswhen a new email arrives in a specific folder, then based on a substring of the subject line the flow looks at a SharePoint list and determines who to send the email to. 

This is how far I've gotten:2018-09-26_1421.png2018-09-26_1422.png

- when a new email arrives

-compose action gets a substring from the subject line

-Initiate a variable called [missionVar] set this variable to the output of compose

-get items from SharePoint list, filter query = [title] eq' missionVar

-Initiate a variable called [emailVar]

-apply to each: set variable [emailVar] to the value of the field [email] from Get Items 2

Any time I try to run this flow  it runs successfully but in the apply to each I get "the input array was empty." message. 

I have tried to change the variable type to string or array, neither worked.

Help?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SylvieLet17
Level 8

Re: Forward an email to a person in a sharepoint list based on email subject

Ok I finally resolved it

It seems like the odata filter query only works with an expression. it doesn't seem to work using the dynamic Fields. With some advice from this thread: https://powerusers.Microsoft.Com/t5/Building-Flows/odata-Date-Filter-Not-Working/td-p/39674 use the concatenate function to combine “title eq"  with my emission variable.  In order to include the quotations but no white space before and after the mission variable I had to do some creative work with the trim() function.

All in all it's a big complex and ugly but it works. 

 

-when an email arrives in a specific folder

-compose: Last(split(first(split(triggerBody()?['Subject'],'Mission')),'for'))

-initialise variable varFilter, value: Title eq '

-Initialise variable varMission, value: Trim(outputs('Compose'))

-get items, filter query: Concat(variables('varFilter'),variables('varMission'),'''')

-apply to each: forward an email to: [get items] email 

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Forward an email to a person in a sharepoint list based on email subject

Hi @SylvieLet17,

 

Do you want to send out an email to someone based on a substring of the subject line? Say if the subject has a value that equals to the Title in the list, an email will be sent to the corresponding email.

If yes, please try to create a flow without initializing variable “emailvar”. I have created the following flow, the email could be sent out properly.

1.PNG 

 

Best regards,

Mabel Mao

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SylvieLet17
Level 8

Re: Forward an email to a person in a sharepoint list based on email subject

Hi!

yes that's exactly what I want, but it's still saying "input array was empty"

 

what type of column are you using for the email?

I'm using a people/group field. 

SylvieLet17
Level 8

Re: Forward an email to a person in a sharepoint list based on email subject

Hey Mabel,

Did you ever get this to work?

Everytime I try to use an output or a variable in my odata filter I get "input array empty" and there are no values in my get items action. If I don't use an output or variable, for instance if I just put  “title eq 'Mission' ” I do get values in my filter query.

I've never successfully been able to use a variable in my filter query or the output of a compose action. Does this work for you?

 

SylvieLet17
Level 8

Re: Forward an email to a person in a sharepoint list based on email subject

Ok I finally resolved it

It seems like the odata filter query only works with an expression. it doesn't seem to work using the dynamic Fields. With some advice from this thread: https://powerusers.Microsoft.Com/t5/Building-Flows/odata-Date-Filter-Not-Working/td-p/39674 use the concatenate function to combine “title eq"  with my emission variable.  In order to include the quotations but no white space before and after the mission variable I had to do some creative work with the trim() function.

All in all it's a big complex and ugly but it works. 

 

-when an email arrives in a specific folder

-compose: Last(split(first(split(triggerBody()?['Subject'],'Mission')),'for'))

-initialise variable varFilter, value: Title eq '

-Initialise variable varMission, value: Trim(outputs('Compose'))

-get items, filter query: Concat(variables('varFilter'),variables('varMission'),'''')

-apply to each: forward an email to: [get items] email 

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 191 members 4,494 guests
Please welcome our newest community members: