I encountered the same issue and reached out to a dev on the Mendix team. He suggested a cause of the problem and it was definitely the issue. Here is what it was:
TLDR; If you delete a TraingingEvent before adding the Prevent Delete logic, you can orphan Registrations. When you trigger a Cascade Delete, this will attempt to delete the orphan Registrations and that is where you get an Empty TrainingEvent.
Solution:
My solution:
The after delete event on the registration Entity is triggered. Caused by the cascading delete of registrations.
My guess is that you retrieve the training event from database in your first activity of the after delete event Microflow.
This should be a by association retrieve. Otherwise the event won't be accessed and thus fail in the fourth activity.
So the error you’re getting is “Change object 'NewTrainingEvent' should not be null”. Do you delete the entity with a microflow? If so is it perhaps possible that you try to change the NewTrainingsEvent while it does not exist?
If you do not use a microflow then this error seems very weird: a participant seems like something quite different from a ‘NewTrainingsEvent’.
I am not so fluent in Mendix programming yet. I just follow the lessons and I edited the behavior of newly created “Delete” button.
and the domain model.
I have not created my own microflow for this action.
What I also found is that I get this error message and I cannot delete participants that were created, before I did the changes within this paragraph.
If now I create a new participant and assign it to the trainings, I can delete such a new participant without any problem.
Hello,
I get exactly the same error, although the code looks like the one in the instructions. (checked multiple times) I am not sure what is going wrong,.
Can anybody lend a hand here?
Thanks.