CiviCRM 4.6.8
I'm using Relationship.create
in a civicrm post hook to create an inherited membership. My membership type is set to use this relationship. However after that API call is successful, the relationship exists but no membership follows.
I was reading the source for api/v3/Relationship.php and noticed this note for the setvalue method. It seems like I need to use it to invoke disableEnableRelationship
.
However, I tried setting is_active to 1 with Relationship.setvalue
in my hook function right after creating the Relationship and still no membership. Is this expected behaviour?
Here's roughly what I have:
$id = $relationship['id'];
$params = array(
'id' => $id,
'field' => "is_active",
'value' => 1,
);
$result = civicrm_api3('Relationship', 'setvalue', $params);
Curiously, I notice if I edit the specific relationship in the admin UI and save, the proper inherited membership gets created.