[Solved) Deleting data from two data types

I have a app where a traveler can record their vehicle based trips and campsites. When a user records their campsite for the night it is also an expense so data is added into two “Types” that is data type Day Summary and data type Expense. All works well with the workflow having two steps.

image

So that the correct expense is edited when required I gave the Day Summary a 7 digit random alpha-numeric string when created and and give the Expense the same string

image

Editing the Day Summary also works as intended and the workflow also has two steps

image

To ensure the correct expense is edited I have this

All works as intended and each time the Day Summary is edited the Expense also edits correctly.

So all is good until a user wants to Delete a Day Summary. I used the same logic to delete the Expense as well as the Day Summary

image

Then

The Day Summary deletes OK but wrong expense is deleted.
When I run the debugger I find that it is not finding the id

image

The first expense in the database is deleted and not the one constrained to the correct id

What am I missing?? The edit works OK with the same constraints so why not the delete??

Thanks in advance for any advice

If you’re deleting the parent group’s day expense, you can’t reference it’s ID to do a search for the next step in the workflow. I’m guessing here, but should you delete the Expense first, then the Day Summary?

Ahh - so easy. Of course it makes sense - you can’t delete it because the id reference has already been deleted. I just swapped them as suggested and all is working as desired.

Thanks so much - this has been driving me crazy for a few days. This is why I love this forum

1 Like

Glad that worked!