Workflow rule doesn't seem to trigger action

I’m currently working on an inventory management application where the user is able to move items from and to locations, while the app keeps track of how many items there are on the various locations. Movements are stored in one table, the inventory in another, and the inventory table looks at the movements table to adjust the numbers so that they are correct.

The problem
My issue is, that if a user wants to move an item from location x to location y, but the item doesn’t exist on location y (in the inventory table), the item will be removed from location x and simply “disappear”. Therefore, if the item doesn’t exist on location y, it should automatically be created on this location (with a saldo of 0), so that the movement is “registered”.

Progress so far
I’ve made an action in AppSheet that does exactly that - it looks at the movements table and checks whether there is an entry in my inventory table that matches this movement. If there is (the item exists on the location), the movement is ignored because everything works as it should, but if there isn’t, it will take the relevant information of the movement and add an entry in the inventory table. But, this is a manual action, which means that you have to create the movement, and then afterwards navigate into this movement entry and press the action button. I tried to automate it by adding a workflow rule that triggers this action everytime a row is added to the movements table, but to no luck. I’m suspecting it’s because the action requires information from a specific row, so when the workflow triggers due to a row being added in the movements table, it doesn’t know what row to pull data from and therefore nothing happens. It’s just a thought though. Any suggestions on how to fix this?

I also tried to create a second action that simply runs the first action on all rows (that are valid) in the movements table, but that included duplicates so that a single item on a single location would have multiple entries in the inventory table, so that didn’t work out either - and even if it did, you’d still have to initiate this second action manually but it would at least be more automatic. I hope all of this makes sense.

Thanks in advance

Solved Solved
0 3 525
1 ACCEPTED SOLUTION

@Viktor After trying to trigger the Workflow, go to that Workflow in the editor and tap the 'Log" button. Check the log and see if the Workflow was successfully triggered and if there are any errors occurring.

From what you described it should be straightforward. The Workflow triggers on an Add and runs an Action. There should be no need to add criteria (unless you decide so) since by default it will trigger on every row added and runs for THAT row. The workflow will simply pass the row to the Action, when the Action is executed.

Keep in mind that the Action will ALSO have its own criteria in it to determine if the Action should run or not for that row.

View solution in original post

3 REPLIES 3

Bahbus
New Member

There are probably multiple ways to pull this off. If your manual actions work just fine, you should be able to have a workflow rule that triggers the manual action. Your workflow would watch the movements table for any adds. Then perhaps the condition should be something along the lines of NOT(IN([ItemName], DestinationTable[ItemName]))? So that the workflow only triggers on adds and then only continues if the item does not appear in the destination table.Then have it trigger the manual action(s).

@Viktor After trying to trigger the Workflow, go to that Workflow in the editor and tap the 'Log" button. Check the log and see if the Workflow was successfully triggered and if there are any errors occurring.

From what you described it should be straightforward. The Workflow triggers on an Add and runs an Action. There should be no need to add criteria (unless you decide so) since by default it will trigger on every row added and runs for THAT row. The workflow will simply pass the row to the Action, when the Action is executed.

Keep in mind that the Action will ALSO have its own criteria in it to determine if the Action should run or not for that row.

@WillowMobileSystems @Bahbus
Thank you both for your answers.
I started with @WillowMobileSystems advice to check the logs of the workflow and I did indeed find an error there. The workflow and action did fire, but the action could not be completed due to the error.

The problem was that the row that was to be added in my inventory table required certain column fields to contain data, but the Action would leave them blank, so the Action would not go through. Oddly enough this was not an issue when I used the Action manually, even though these column fields would still be blank. Anyways, to solve it, I simply unchecked the “Required” box in AppSheet for these columns, since the data that is supposed to be in these, is computed on a spreadsheet level, meaning the user has no control over them, and therefore the “Required” box was unnecessary. This solved the issue.

Top Labels in this Space