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

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
Highlighted
Helper V
Helper V

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
Highlighted
Community Support
Community Support

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.
Highlighted
Helper V
Helper V

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. 

Highlighted
Helper V
Helper V

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?

 

Highlighted
Helper V
Helper V

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

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

Top Solution Authors
Top Kudoed Authors
Users online (7,501)