Forum Discussion
kc1986
Nov 15, 2022Copper Contributor
Internal ordering/Shopping system
Hello all I am looking at ways to build a platform/simple system where our IT team can list some items they want to get rid of for example laptops, monitors etc, and our internal staff can access...
RobElliott
Dec 04, 2022Silver Contributor
HI Kay kc1986 , very sorry for the delay. The system is shown below:
1. Create your form first. Make sure in the settings that you select only one response per person.
2. Next create a list in SharePoint for the items available and the number of each item in stock (number column, no decimal places). The items must be unique and the text in the title column must match eactly the text in the Form:
3. Next, create an instant cloud flow from blank. Do not use the Forms template in Power Automate, there is an error in it that can cause the flow to fail and Microsoft have never fixed it. YOur trigger will be the Forms when a new response is submitted. Select your form from the dropdown. Then add the Forms get response details action. Select your form again and then click in the Response ID field. The dynamic content box will open in the bottom right of your screen, select Response Id.
4. Next add a Compose action, click in the Inputs field and from the dynamic content box select the question in the form where they select the item they want.
5. Add a SharePoint Get items action, select your site and the list where the inventory and stock count is. then click the advanced options link. We only want to bring back the one item from the list so click in the Filter Query field and type Title eq '' and between the apostrophes select from the dynamic content the outputs of the Item REquested compose action that you did in the previous step.
6. Although we're only bringing back 1 item, because of the get items action you need to add an apply to each and select value from the get items section of the dynamic content box
7. Inside the apply to each add another Compose action and select from the dynamic content box the Stock.
Next add a Condition and click in the left field. Select the outputs of the Stock compose in the previous step. Leave the middle field as is equal to and in the right field type 0. So this condition checks if the stock for the item selected is equal to 0.
8. When you add a condition it will automatically add the green if yes channel and the red if no channel. In the green if yes channel (in other words there is nothing in stock) just add a send an email (v2) action. In the To field click the 2 arrows at the top right of the field and select Responder's Email from the dynamic content box. Enter the subject and the body of the email which will say that the item is out of stock. You can add the title of the item that the responder wanted.
9. In the red if no channel (i.e there is at least 1 of the item in stock) add a SharePoint create item action, select your site and the InventoryRequests list. In the title field select Responder's Email. In the item select the question where they said what they wanted.
10. We now need to subtract 1 from the number of the item in stock. Add a compose action and click in the Inputs field. In the dynamic content box select the Expression tab and add
the following expression sub(outputs('Stock'),1) and click OK.
11. To update the stock level add a SharePoint Update item action. Select the site and list. In the Id field select ID from the get items selection of the dynamic content box. In the stock field select the Outputs of the Subtract1 compose you created in the previous step.
12. Finally add a send an email (v2).
13. So when the form is submitted the flow will run. In this example there was 1 Bose Headset in stock (#2 above) so the request was successful, the request was added to the InventoryRequests list and the responder received the following email.
14. The flow subtracted 1 from the stock level so there are no Bose headsets left in stock:
15. So the next user who requests it will receive the following email.
Come back with any questions about this.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Lancelotyuan
May 09, 2024Copper Contributor
Hi RobElliott Good day this ordering system was amazing, could you help me how can i do if the request is more than 1. sample my request is 10 mouse what code do I need and in will automatically deducted on my inventory list. it depend on the quantity request of the item. hopefully you can help me.
Thank you
Lancelotyuan