cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SylvieLet17
Responsive Resident
Responsive Resident

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
Responsive Resident
Responsive Resident

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
v-yamao-msft
Community Support
Community Support

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.

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. 

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
Responsive Resident
Responsive Resident

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (81,872)