Hi,
I am trying to automate sending an email to different Org Codes within my organization based on the subject of the email coming in. For example if the Subject of the email contains Org code H45, I want it to send to the people from H45. If it contains B12, I want it to send to the people from B12 and so forth. There are about 30 Org codes so I don't think there is a way to use the Condition Action so I'm trying to use Switch and then use the function "contains" to find the organization code and trigger the email to the right place.
This is what I have for the contains function, but it's not working:
Hi @acondie ,
Looks like you are using Person/Group type of column.
Initialize a variable of type string and inside apply to each append the email to that variable by adding the dynamic email content and add a ; after that.
Now move your send email action outside of the apply to each action and in Send To pass the variable that will have all email IDs.
If this solves your problem , give this a thumbs up and mark this as a solution to close this thread.
Thanks,
Sanmesh
Okay this seems to be working now-
The only issue now, is the email is sending three times? How do I stop that?
Hi @SanmeshG ,
I appreciate the help. I think I'm really close.
I'm pulling the "Org" from the body of the email and then using that to go to the Sharepoint list and pull the contact emails (right now just using one person). That all seems to be fine when I test it and I get the correct outputs. However, when I go to send the email, I run into the issue where the email ends up being blank. The "subject" and "body" of the email keep changing to the Sharepoint image, even though I input them as outlook.
Do you know what I could be doing wrong?
Hi @acondie ,
Here you might have extracted the Org Code from the email , pass that in the filter query
For ex :
OrgCode eq 'ABC'
Here ABC is the Org Code and OrgCode is the internal column name of your column from that list , now you get the Emails that are mentioned for this or in the list , pass that in the To parameter(Remember here it depends again whether you have a multi-select people or Person column or a multi-line text column)
If this helps , please give this a thumbs up and mark this as a solution.
Thanks,
Sanmesh
Hi @SanmeshG ,
I'm trying to build this out like you suggested, but I'm a little confused by what you mean when you say "email query", won't I still need to create a condition for each Org?
That's very smart! Thank you! I'll try that and get back to you if I have any questions.
Hi @acondie ,
Since you have mentioned you have about 30 Orgs , I would like to suggest an alternative approach , if you using switch that becomes a tedious/lengthy approach. So here's what I think you can do.
Create a list in SharePoint , and store the Org codes and the associated people (here its not mentioned how many people are there for each org, I think there is a limitation on how many people you can save in people picker column , so you can consider using a multiline text and add the email IDs separated by semicolon).
Now once you find the Org Code from your email query the SP list using Get Items and send the email to the associated people.
Hope this helps!
Please give this a thumbs up and mark this as a solution if this answered your question.
Thanks,
Sanmesh
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional