I have a customer where it is vital that there is only one Case Role on a case. In the CaseView form it is possible to add a case role, and I want to add some validation to this. in core actual processing is done in a jQuery function, with the callback function at CRM_Contact_Page_AJAX::relation.
I can do nothing with a validateForm hook here, so what I am planning to do is:
- create a 'dummy' page with my own version of CRM_Contact_Page_AJAX::relation with the desired validation included
- replace the template for CaseView with a local version, linking to the new function with the alterTemplate hook
Unfortunately this solution is not viable for a true generic extension. Any better ideas? If not, I will add the instruction to the README and still publish the extension as it might be useful for others too but I wonder if there is a better way.