Please help me how to pass the dynamic parameters for sending email to SharePoint approvers list when item created in SharePoint list using edit form and while clicking submit button item getting created and I got to trigger email from MS flow and refer the blow steps and refer below Approver list details for the same.
Kindly revert incase of any details. Thanks in advance.
Background:
Email trigger to below users from SharePoint Approvers list Title=HR
Flow steps:
Importantly, To field email address should be coming from SharePoint configuration list Approvers
Solved! Go to Solution.
Go back to Your original list for approvers and all should work the code with Concat + lookup will do the job
i notice there is and issue how You created emailaddresses if you done that table and this column this way you will not need to concat anything concat is to add separate records together by ";" if there are not in same cell so if you placed two emails in one cell this is not required
Hi @Veblitz
EditForm have a property called LastSubmited You can use this to retrieve last ID and for the email just use User().Email
"Flow".Run(User().Email, EditForm1.LastSubmit.ID)
make sure it's starts flow OnSuccess to avoid running flow when something goes wrong
Here are more details about the properties of the EditForm
Thanks for your inputs
do we need to write the formula in onsuccess property but not in button click since to prevent the flow if any errors in the form so in that context we got to run the flow in editform onsuccess property right?
"Flow".Run(User().Email, EditForm1.LastSubmit.ID)
Then I also need to trigger email for users who are in approvers SharePoint list Title is "HR" and please let me know how to check that condition
You can Create a collection :
Collect(HR_Mail,
Filter("HR List",
Title = "HR")
)
Then depend if You need the user Email You are leaving User().Email add another Variable to the flow Text called HRMail at the end, then add in the Formula additional code that will pull emails from the collection
"Flow".Run(User().Email, EditForm1.LastSubmit.ID,Concat(HR_Email,Email,";"))
And put whole this code into OnSuccess
Collect(HR_Mail,
Filter("HR List",
Title = "HR")
);
"Flow".Run(User().Email, EditForm1.LastSubmit.ID,Concat(HR_Email,Email,";"))
Keep in mind I assume under HR List You have more than 1 email if there is one just use lookup, but the filter will do the same thing
In this Scenario, the Title column contains Role Name Like HR and Column with Email Addresses is called Email
Thanks for your inputs and i would test the same and keep you posted if its done.
Much appreciated
I tried adding the above formula but I'm getting few errors in the onsuccess property of my editform
Also, IN my MS flow steps i created email variable to fetch values from PowerApps dynamically and let me know if i got to alter anything in overall context or revert incase of any issues.
Flow background: Im getting the item ID post editform submission and updating the status in list1 and sending email to approvers list in my case .Please review the flows for overall idea and the list configuration settings.
Thanks in advance.
Flow steps
You only have two Variable if the email You are passing is only the HR and You do not pass User Email just use this formula
"Flow".Run(Concat(HR_Email,Email,";"), EditForm1.LastSubmit.ID)
Other than That, You need to add another variable in your flow called for example HRMail
Thanks much,
Last but not least,Unfortunately, concat function returns invalid argument error type
I added a string variable in my flow as per below
but forumla returning errors in concat line ,function concat has some invalid arguments.Invalid argument type(Table) expecting a text value instead
the order is important and based in what order You created Variable on Your screen it's ID than Email in that case You need to use
"Flow".Run(EditForm1.LastSubmit.ID,Concat(HR_Email,Email,";"))
Many Thanks for valuable inputs!!! Much appreciated.
Though I passed as per flow order,its throwing error in concat line.
Unfortunately still my formula returning errors in concat line ,function concat has some invalid arguments.Invalid argument type(Table) expecting a text value instead
User | Count |
---|---|
255 | |
114 | |
95 | |
48 | |
38 |