I want to create a simple workflow where user inputs Restaurant name and number of reservations and clicks on “Submit” and the workflow has to go to “Bookings” database and search for the restaurant name and update number of reservation to be existing reservation number + new inputted reservation number (in my example it will look for Mcdonalds restaurant and add 3 so total will be 8)
Appreciate your help with this use case , I’ve been struggling for many hours on this now , also I tried to use the same way of one of the tutorial lessons (To create a voting city app) but It didn’t work as that one requires having a repeating group.
You can think about it similar to order submissions (how to reduce number of stock of the ordered product) similar but in my case I want to add instead of reduce.
@majd It should be a ‘make a change to thing’ action as you noted. Find the thing with ‘do a search on Bookings’ with constraint name = McDonalds. Then for field reservation = this booking’s reservation + input reservations value
Because restaurant is a free input field, be sure the value you check is consistent.
For example: Input can be Mc Donalds, MCdonalds, or MacDonald’s.
So you may have to transform the input to lowercase, with no special characters and no spaces, like: mcdonalds.
Then also when the restaurant does not exists you have to create a thing with a initial amount of reservation.
So you have to define two workflow triggers on click. One based on a condition that executes a ‘create’ only when the the count of your search is 0. And another one that executes a ‘make changes to a thing’ when the count of your search is 1 (or not 0).
Other option is to create and maintain a list of available restaurants yourself with initial 0 reservations. Then users can select or search the restaurant from a drop down, and put in the number of reservations. In this case you can only use the ‘make changes to a thing’ workflow event.
I am not an expert but this is how I would set it up.
Thank you @neerja and @FJP for your replies.
I’m still struggling with the implementation of the workflow , as you can see in this screenshot I’m not able to complete the workflow criteria and it keeps showing as red (as in complete).
Do a Search for Bookings and add a constraint: “restaurant = input_restaurant’s value”. Then you get a notification that you trying the change a list of items instead of an item.
Click on the button in this notification to solve this. Your thing to change will be updated to: “Search for bookings:first item”
Than you click “+ Change another field”. In there you do: reservations = “This booking’s reservations + 1”.