Bug: Delete a Thing not deleting from database in a Repeating Group

I am trying to delete a thing (Parent’s item) in a repeating group,
It deletes it from the UI(Frontend) but the item comes back on reload. So it is not deleting it from the database.
And there is no Privacy rules applied on the item that i want to delete.

Have you tried using the step by step debugger with ?debug_mode=true in your URL?

not yet, will try, thanks!

yes i tried the step by step debugger, the delete step is initiated and it deletes the thing as visible on the UI, but on reload it comes back.
I don’t know why is it not deleting from the database.

Then you must have a workflow that’s creating a new thing (maybe on the same button click or in a backend trigger)

It is actually a bug.
Because if I put the condition on terminate action instead of the delete action it works fine!

So This bug needs to be fixed, I will use this workaround for now.

I don’t think it’s a bug - it’s probably a timing issue.

It looks like you’re using a Run Javascript action to pass a value to a JStoBubble element, and then using that JStoBubble element’s value in the next step (as the condition).

Is your javascript running as an async function? (I’m guessing it is, as that’s the default setting for the Run Javascript action).

If it is running async then the value probably won’t be set correctly by the time the condition is evaluated (at least the first time you run it) - so the condition will fail, and the thing won’t be deleted (this is very likely what’s happening in your case).

The ‘solution’ of adding a terminate workflow step is probably just slowing things down a bit and giving it time for the value to be set before the condition is evaluated - or it might be causing the thing to be deleted when it shouldn’t be - either way, it’s not a reliable or robust solution… it likely won’t work correctly 100% of the time.

The correct way to ‘fix’ this is to run the JS action synchronously (or you can set it to trigger an event, and then use that event as the trigger to delete the thing - but unchecking the async box is the simpler solution).

It’s running in sync manner as i have already unchecked it.
But you are right it can be a timing issue, so now i have changed the JstoBubble to trigger the event instead of returning the value. so it works 100% all the time.

So it’s still a bug because even when it was running in sync manner, it was not running properly. It was only when i used trigger event I was sure that the problem will be solved.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.