2

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:

  1. create a 'dummy' page with my own version of CRM_Contact_Page_AJAX::relation with the desired validation included
  2. 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.

  • Whilst doing this I ofcourse found that I can not use the alterTemplateFile hook as CaseView is a Page rather than a Form.... – ErikH - CiviCooP Apr 30 '15 at 13:49
  • Is it that you want one and only one case role per case, or one of each role. I'm not quite sure how it can be the former because technically "Case creator" and "Case client" are both roles, so a freshly created case will already have 2. – Coleman May 30 '15 at 17:15
1

Futher investigation has given me at least one answer. I can create my own template file with new jQuery functions using my new function as a callback. In that new jQuery function I can replace the .onClick functions for the button 'add Role' and the edit pencil. But still open to better suggestions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.