3

I'm doing this call

$result = civicrm_api3('Relationship', 'getvalue', [
  'return' => "contact_id_b",
  'relationship_type_id' => 5,
  'contact_id_a' => "user_contact_id",
  'is_active' => 1,
]);

It is returning contact B from contacts that are in trash.

I want to filter for contacts that are not in trash but struggling to find a way of doing it.

4

This seems to work, using a join:

$result = civicrm_api3('Relationship', 'get', [ 'sequential' => 1, 'return' => ["contact_id_b"], 'relationship_type_id' => 5, 'contact_id_a' => "user_contact_id", 'is_active' => 1, 'contact_id_b.is_deleted' => 0, ]);

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.