Create and Update an Entity based on changes of other Entity
Hello Mendix Community, I am new to mendix, and I really hope to get some help from you. I am trying to create a calendar, which shows and updates all the appointments from different entities. So, I created an “Calendar”- Entity, where specific attributes of HouseInspection Entity (like start date) should be updated based on the changes of the houseinspection entity, or create a new list, if there is no calendar list for that houseinspection created. I simply cannot make this working. :( The association is one-to-one and I thought, that I should create an event handler in the HouseInspection- Entity, with a microflow, that creates and commits a calendar list if there is no one created. If there is already a calendar list for the houseinspection selected, then the values should be updated, if something in the houseinspection enitty changed (like starting date etc.). Can you please help, to create such a microflow or provide me other best practices or tips to make this work? Thank you in advance. Mendix Version is 9.0.2
Your domain model is wrong. If you want a list of Calendar events you have multiple Calendar objects pointing to the same HouseInspection and thus a many to one relation. And indeed do a retrieve of all the Calendar objects and if the list is empty create the object and set the reference. May be you forgot that part.