I'm trying to find a best way to setup relationships to the Club that would only "allow" one person to be ex. "Secretary", "Coach" etc. Can this be done via Rules (either CiviRules or Drupal) or database trigger or, hopefully not, a custom module? So basically, when a person gets assign a role, whoever had that role previously has the relationship removed or ended or de-activated.
2 Answers
I can answer for CiviRules: at the moment there is no such combination of condition and action available in CiviRules.
But there is no stopping you to develop (or have someone develop) such a combination for you. It does not sound too complicated for someone familiar with CiviRules.
Do you have the ability to develop this yourself? The condition would be 'relationship is of the type(s)' (that one already exists) and the action 'de-activate previous relationship' would have to be developed.
There is documentation on CiviRules here: https://docs.civicrm.org/civirules/en/latest/.
Documentation on how to develop your own action is here: https://docs.civicrm.org/civirules/en/latest/create-your-own-action/
Pretty sure we have done this via (incorporated in an existing) extension. I don't recall what there was by way of an interface, ie if you could specify relationship type X has a max of 1, but relationship type Y has a max of 3 - or if we just hard-coded for that situation.
It may not take much to refine for public consumption or for your specific use case (ie without a UI)
-
-
no - sorry if that wasn't clear - when we did it it was part of a custom extension for a client. and per my comment i don't recall if it had a UI or was hard coded in terms of which relationships had what maximum set– petednz - fuzion ♦Commented Jan 15, 2019 at 20:53
-
Understood. If it's possible I hope I'll find the way myself - I'll learn more of the system on the way :-)– RalphCommented Jan 15, 2019 at 20:54