cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tested1
Level: Powered On

When user creates a new item, approval triggers to a specific email

Hello everyone!

 

I have a very simple approval process where users fill in a form on a list

 

1) User creates request

2) Depending on the users email domain, it will go to the equivalent approver

 

I want it so if the user who creates the item has the email domain ......@test.com, the approval system will go will go to approver who deals with only ...@test.com emails

 

But if the user has anything other than ...@test.com email d omain then it will go the Approver who deals with anything other than ...@test.com So there are two scenarions.

 

Examples:

 

User with microsoft@test.com creates an item, it will then go to the approver who deals with this domain e.g. microsoft approver@test.com

 

Another 5 users create new items all with different domains e.g. microsoft@different.com, microsoft@help.com all other domains which dont have ....@test.com should go to this approver and not the one for...@test.com

 

Is this something that can be easily done?

 

Thank you!!!

8 REPLIES 8
Highlighted
Jay-Encodian
Level 10

Re: When user creates a new item, approval triggers to a specific email

Hi,

I'd suggest the following approach...

  1. Create a SharePoint list to store a list of approvers and a column to store mapped domains 
  2. Create a variable in your Flow to store the current domain name, utilise a substring expression on the '@' character to retrieve the domain.
  3. Utilise the SharePoint 'Get Items' action to query the list created in step #1, applying an OData filter to the domain column passing the variable from #2.

This should enable to you obtain the relevant user / users which you need to contact relevant to the domain... it also provides a simple way to update the solution without needing to change flow.

Please mark as a solution if this helps solve your issue

Cheers Jay

tested1
Level: Powered On

Re: When user creates a new item, approval triggers to a specific email

Thing is the domains could be hundreds-thousands and loads of different usernames at ..@domain.com

 

Do you have a pictures of this flow please? Sorry im still learning it

 

Maybe I could have 2 approvals if domain =1 it goes to approver 1 if 2 goes to 2?

 

Thank you

Jay-Encodian
Level 10

Re: When user creates a new item, approval triggers to a specific email

Hey, sorry I misread your original requirement... I’ve reread and in essence there are two approval routes, one for  specific domain and the other for all other domains. 

 

I’ll pull together an example Flow later and share details, it’ll be less complex than I suggested.

Jay-Encodian
Level 10

Re: When user creates a new item, approval triggers to a specific email

Ok, there are two ways to do this... a simple condition check or a more complex condition check which is probably overkill.

The easy way

Just simply check whether the current email address 'ends with' @test.com2019-02-02_19-19-09.png

 

 

A bit more complex...

This more complex route will enable you to extract the domain from the email address, which may be helpful within your logic.

The expression pointed to is: 

substring(variables('EmailAddress'),lastIndexOf(variables('EmailAddress'),'@'),sub(length(variables('EmailAddress')),lastIndexOf(variables('EmailAddress'),'@')))

2019-02-02_19-13-50.png

 

If this has solved your query please marks as solved 🙂

Cheers J

Jay-Encodian
Level 10

Re: When user creates a new item, approval triggers to a specific email

... just to add, if you're using Flow approvals, here's an example:2019-02-02_19-33-44.png

 

 

tested1
Level: Powered On

Re: When user creates a new item, approval triggers to a specific email

Thank you @Jay-Encodian I will try this tomorrow and feedback!

tested1
Level: Powered On

Re: When user creates a new item, approval triggers to a specific email

 hi @Jay-Encodian

 

Can you help me on this error that I have when I tried to click save on my flow? I have attached 4 pictures

Error: The template validation failed: 'The inputs of template action 'Send_an_email_3' at line '1 and column '7222' cannot reference action 'Start_an_approval'. Action 'Start_an_approval' must either be in 'runAfter' path or within a scope action on the 'runAfter' path of action 'Send_an_email_3', or be a Trigger.'.

 

error 1.png1error 2.png2error 3.png3error 4.png4


 

tested1
Level: Powered On

Re: When user creates a new item, approval triggers to a specific email

Any ideas please 😞 

 

 WT....(ef). I figured it out!

 

It was because the body of the 'send an email 3' had the same contents as in send an email 2... Both had e.g. 'Your site has been approved. Comments:' I changed the wording in the body of send an email 3 and it works now!!!

 

It looks like it didnt like the fact i copy and pasted the body from send an email to the send an email 2 as they had the same dynamic contnet or something

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,594)