Multiple Relationships in CiviCRM Views Integration I have been trying to set up a Drupal View of a a 3-way relationship in CiviCRM.

The view I wanted was that showed a list of contacts that are provided services from the current user's employer, as below

(current user) contact a => (is employed by) => organisation => (is a provider of) => contact c 

I created a view of CiviCRM Contacts, and could not see a way of getting this relationship to display what I wanted without building a custom module, which is explained below.
You can do this with a custom module and using the preprocess views hook to pass in the contextual filter. The filters are passed into the $args[] variable. 

You also may need to enable multiple values in a contextual filter, if you have more than one relationship from Contact A to Contact B, in this case this is multiple employers. This is under Contextual Filters > Advanced > Allow multiple values.

You do not add % to the path as you would normally do with a contextual filter as we are programmatically inserting it.

Create a custom Drupal module with the following code

/**
* @implements hook_views_pre_view().
*/
function HOOK_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args){

if($view-&gt;name == "my_view") {
      // Check that we are altering the correct view based on and $view-&gt;name
      civicrm_initialize();
      require_once 'api/api.php';
      //get the matching civi id for the current user
      //This is using Civicrm version 4.4.6

      global $user;
      //first get the current user's Civicrm record
      $params = array(
         'version' =&gt; 3,
         'sequential' =&gt; 1,
         'uf_id' =&gt; $user-&gt;uid,
      );
      /*The contact ID is in $result['values'][0]['contact_id']*/
      $result = civicrm_api('UFMatch', 'get', $params);

      $params = array(
          'version' =&gt; 3,
          'sequential' =&gt; 1,
          'relationship_type_id' =&gt; 5, /*get your relationship ID from /civicrm/admin*/
          'contact_id_a' =&gt; $result['values'][0]['contact_id'],
      );
      $result = civicrm_api('Relationship', 'get', $params);

      //temp stores the string which will be passed to the $args[] array
      $temp = "";

      //loop through the a =&gt; b relationships, and append all the ids of contact b
      foreach ($result[values] as $key =&gt; $value ) {
         if ($key &gt; 0)
            $temp .= "+";
         $temp .= $value['contact_id_b'];
      }
      // populate the $args contextual filters array with the ids.
      $args[] = $temp;
   }
}