I have a dataobject in which I need relation data for a function on the first onBeforeWrite. The relation is set with DropdownField populated with a toDropdownMap in the CMS. In theory I should be able pull the ID from that form element but I'm not sure how its passed to the onBeforeWrite function. Calling $this->RelatedDataObejct doesn't work because that relation isn't set yet. And I can't get the form Value with $this->getField();
I could call the function I need in onAfterWrite and only fire it if the value I'm creating is null and putting another write function in it but that just seems like a recipe for disaster with potential write loops
Any ideas?