I have been asked to add some custom fields to the default CiviCRM Interface that bahave like the current employer field.

That is to say, my users want to create certain relationships and have them turn up in the relationships tab.

I had originally implemented this as a contact reference with a filter to look up the specific sub-set of contacts needed but I have been asked to make them relationships.

I realise I can implement this using webforms integration (we are using Drupal 7) but I have been specifically asked to implement this on the default UI.

I have also read it can be achieved using hook_civicrm_post however, I was hoping there was a more straightforward way that I was overlooking so that if in the future one of my users needs to add a new relationship custom field they don't need to update code in an extension

2 Answers 2


You might have already checked field like "Current Employer" that creates new organization and relationship. Post hook is the most straight-forward and correct way to proceed here.

You could give a common prefix kind of name to your custom field and write your code in such a way that it performs the action only when custom field has that prefix in the title/name. This way, you won't need to modify the extension every time a new custom field is added.


@jitendra's answer is how we will likely proceed to some extent however we will likely integrate it with something like Relationship block which seems to do a lot of what are users want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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