Forum Discussion
SharePoint Event - Participant Registration
- Mar 19, 2023
The flow I mentioned in the previous post looks like this.
After the when a new response is submitted trigger and the get response details action add a get user profile action to get the details of the user who has registered. Then initialise a variable set the type to float.
In your SharePoint list make sure you have a number column for the number of participants registering - for some of our courses a user might register 2 or 3 people from their team. You can set the default to 1.
To count the number of people registered add a set variable action, select the variable and then add the following expression (changing the NumberOfParticipants column to whatever name you've given your number column):
xpath(xml(json(concat('{"root": { value:', outputs('Get_items')?['body/value'], '}}'))), 'sum(//root/value/NumberOfParticipants/text())')Next, add a condition of varCount is less than 25
In the green if yes channel add a create item action to add a new iten into the list. Then add a Send an email (v2) action or a send an email from a shared mailbox action and add the "you're registered" text.
Finally in the red if no channel just add the email action with the "sorry...." text. You could then have a create item action to add this user to another list for a future event.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
nhtkid from an event registration request from Forms we use a flow in Power Automate to check a list in SharePoint and count how many people have registered. If the number is less than the maximum number of participants, for example 25, the flow saves the form response into the list and sends a "you're registered" email. If it's more than 25 it sends a "sorry, the event is fully booked" email.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- RobElliottMar 19, 2023Silver Contributor
The flow I mentioned in the previous post looks like this.
After the when a new response is submitted trigger and the get response details action add a get user profile action to get the details of the user who has registered. Then initialise a variable set the type to float.
In your SharePoint list make sure you have a number column for the number of participants registering - for some of our courses a user might register 2 or 3 people from their team. You can set the default to 1.
To count the number of people registered add a set variable action, select the variable and then add the following expression (changing the NumberOfParticipants column to whatever name you've given your number column):
xpath(xml(json(concat('{"root": { value:', outputs('Get_items')?['body/value'], '}}'))), 'sum(//root/value/NumberOfParticipants/text())')Next, add a condition of varCount is less than 25
In the green if yes channel add a create item action to add a new iten into the list. Then add a Send an email (v2) action or a send an email from a shared mailbox action and add the "you're registered" text.
Finally in the red if no channel just add the email action with the "sorry...." text. You could then have a create item action to add this user to another list for a future event.
Rob
Los Gallardos
Microsoft Power Automate Community Super User- nhtkidMar 20, 2023Iron ContributorHi Rob,
Thank you so much for your detailed explanation.
I will follow your example and give it a go.
One question, we are adding the Forms link into each SharePoint event details for people to sign up. And the count would only happen once user submit the registration form and trigger the flow.
That means the exceeded person will always fill the form not realising it wasn't successful until the email arrives?- RobElliottMar 20, 2023Silver Contributor
nhtkid that's right. Using Forms there is no other way to do it other than for the user to submit the form and get the email response. The flow can't run halfway through the form being filled in. And as there is no way to have dynamic or pre-populated content in a form it cannot check the list before the user starts to fill in the form. This is one of the downsides of using Microsoft Forms for this. If you created the form in Power Apps then you could do a check before the user submitted the form.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- NaomiVBSep 18, 2023Copper Contributor
RobElliott I am having issues with the "Set variable" portion. This is what I am putting in (I have put the name of my number column as the same as what is in the formula): xpath(xml(json(concat('{"root": { value:', outputs('Get_items')?['body/value'], '}}'))), 'sum(//root/value/NumberOfParticipants/text())')