cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jmm07g2789
New Member

Automatically send created invoice to different groups of people

Good morning! My department creates monthly invoices that we send to other departments. They are created in excel and then saved to PDF. AS of right now, my staff manually sends these 50 invoices to the end users. I am trying to come up with a solution that automatically sends invoices to the right people. 

 

My initial thought was using a flow that would send an email when a file was uploaded to SharePoint, but i think the issue I'm running into is how to tell the flow who to send each invoice to. Each invoice has to go to a unique Principal Investigator and then 1-2 support staff. 

 

I was hoping to create some sort of database for the flow to query but I cant quite figure it out.

 

Any ideas would be greatly appreciated.  Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User
Super User

@jmm07g2789 

Another idea might be to create folders for each department.  The Flow could send emails based on the folder name.

If you have a standard naming convention for the files and the department can easily be parsed from the file name, your Flow  could send emails based on the file name.

In either of these cases, it would be best to store the departments and emails in a SharePoint list and then lookup the names in the list from your Flow.

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

10 REPLIES 10
eric-cheng
Solution Sage
Solution Sage

Hi @jmm07g2789 ,

 

I would create a SharePoint list as a lookup table.  If you have Dataverse, you could look into that also.

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

ScottShearer
Super User
Super User

@jmm07g2789 

Another idea might be to create folders for each department.  The Flow could send emails based on the folder name.

If you have a standard naming convention for the files and the department can easily be parsed from the file name, your Flow  could send emails based on the file name.

In either of these cases, it would be best to store the departments and emails in a SharePoint list and then lookup the names in the list from your Flow.

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

I like where this is going. Would I create a separate SharePoint list to include the names of the recipients for each department? And then the flow would basically be "if this department, look at recipient list, and email those people"?

@jmm07g2789 

Exactly

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Hey Scott, me again. So I've tried to figure out how to parse out the name of the department but seem to be stuck. Here's what I have so far:

 

jmm07g2789_0-1629812637529.png

I assume the Filter query in the Get Items action is where I need to parse the beginning of the file name out. The file name is Music July 2021. I tried first(split(triggerOutputs()?['headers/x-ms-file-name-encoded'],' ')) but that resulted in an error. 

 

Can you point me in the right direction in terms of the expression that needs to go in that field? The column in the list of departments is the "Title" column and contains "Music".

 

Thanks!

 

@jmm07g2789 

Try this:

substringof('Music',Title)

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

I'm getting a "The expression is invalid". I've tried similar expressions, and it doesnt seem to like using the column name. I always seem get that same error message.

 

Also the "Music portion is going to be dynamic (based on the file name which will always be in the "Department Month Year" format. I think hardcoding Music is good to test, but i will need to make that change eventually.

Update: I was able to get this to work. Now i just need to figure out how to replace 'Music' with a dynamic substring of all the characters preceding the first space. Thoughts?

Try using a split() expression and splitting on a space.  

In my example, I assume that department is always a single word.  Split generates an array.  The [0] in my expression gives me the first element in the array.

image.pngimage.png

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

So, probably a more efficient way to do this, but i was able to get it to work.

 

jmm07g2789_0-1629822497288.png

Thanks for all the help Scott. I appreciate it!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,236)