Ok, let me give it a try as well.
Create a custom Add button that calls a microflow taking the organization as input parameter. However in contrast to Tim's solution (to me it is not clear were the planning object is created in this solution), create a Planning object and set the association to the Organization. Pass this new Planning object to the existing Planning_NewEdit (the page you included in your screenshot).
Finally, in the tab Selectable objects of your CostCenter ReferenceSelector, use the ConstrainedBy to constrain over the Planning_Organization association.
This should do the trick.
Have the Add-button call a microflow that takes as inputparameter the Organisation and have the microflow Open-page the Add-planning-page. On the add planning page also place a dataView having the Organisation source, so as page parameter. Within the dataview place your Planning-fields and buttons.
Being able to pass more than just one single object to activity open page would make it easier: https://forum.mendix.com/link/ideas/732
Hi Laura,
The easiest and most effect solution to your problem would be to create a temporary Template entity. You can associate Organisational Unit to this entity and this template entity would be the main entity to the page. You can create an object of this template entity when the user presses the New button and delete it when Save/Cancel.
I hope this helps.
Thanks,
Sharad R K
Hi Tim,
thank you! I did this so far:
The microflow leads to the "Add Planning" page. But I still get errors:
"The selected page 'PlanningAdd expects an object of type OrgUnit which is not compatible with the object of type 'Planning' that is available here." But actually I need the Planning object because the Button is there to create a Planning object. Initially, the "Add-button" was a Create Button.
"All data views receiving object from from the page parameter must have the same entity"
and
"A nested data view with data source 'Entity (path)' should specify a path over an association, not simply an entity." But as there is no direct association between the Orgunit entity and the Planning entity, this doesn't seem to be possible. I don't want to associate the two entities with each other as it would reduce data quality.
So, how can I overcome these errors now?
Please note that I am an absolute beginner and do not have any developer skills, I'm still at the beginning but I am trying to learn and understand.
Thank you so much in advance!
Laura
Add Jeroen's suggestion to mine and indeed in the microflow: Planning has to get the reference to the OrgUnit added and then call the page where Planning is the page parameter (don't add Organisation as the pageparameter).
Now you will have the organisation available and you will be able to use the same XPath you used at the start.