I want to display Contact B ID of a relationship for the current contact. I am building a hook and this is my code so far.
if ( $formName == 'CRM_Contactlayout_Form_Inline_ProfileBlock') {
if ($form == CRM_Core_Action::ADD) {
$ID= '190';
$defaults['custom_189'] = $ID;
$form->updateElementAttr('custom_189',array('readonly'));
}
I want to replace 190 with a code that grabs the contact ID of that current users relationship.
Your help is much appreciated.
Thanks
buildForm
, but I can't be sure? That will matter for getting the current user. Finally - have you looked at API Explorer (Support » Developer » API Explorer)? Ultimately you'll be using theRelationship.get
API, and the API Explorer will generate the code you need.