Answers.Body: <p>We ran into the same issue and didn't want to customise the webform module as it is heavily relied on for a lot of data input and needs to be kept secure and easy to maintain.</p>
  
  <p>So we built a Drupal view displaying the Volunteers based on their relationship to the Staff member (I'm assuming they are related in CiviCRM). When the Staff Member visits the page, it can restricted to show only those the have an active relationship to using a contextual filter to the Drupal User.</p>
  
  <p>This post should help if you've not done this before: <a href="https://civicrm.stackexchange.com/questions/739/how-to-create-a-drupal-view-with-multiple-civicrm-relationships">How to create a Drupal View with multiple CiviCRM relationships?</a></p>
  
  <p>We then created a link (using the views Global Text field) to the webform to prepopulate the Volutneer as cid2 or contact 2 (assuming the staff member is cid1) which looks something like this: 
  myorganization.org/node/1?cid2=[id] where [id] is the id of the volunteer.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-06T08:11:07.713Z
Answers.LastActivityDate: 2017-06-07T07:32:22.190Z
Answers.LastEditDate: 2017-06-07T07:32:22.190Z
Answers.UserDisplayName: Heather O.
Body: <p>I have a webform for staff members to record supervision with volunteers, and each staff member has approximately 10 volunteers that they are the named 'Link Worker' for. The webform has a field for the Staff member's name and a field for the Volunteer's name (both using autocomplete so that it allows users to select from contacts already in the database).</p>
  
  <p>My question is, is it possible to filter the volunteer contacts by the Staff Member? (i.e. if we select "John Smith" as the Staff member, can we restrict the volunteers to those who John supervises?)</p>
  
  <p>I think the answer is no, it's not possible, but just wondering if anyone has any suggestions....</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T15:16:13.963Z
Comments.Text: Your question seems to involve only Drupal and not CiviCRM? If that is the case you will possible get more exposure on the Drupal Questions Stack Exchange site.
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T15:16:36.767Z
Comments.Text: Do you use a relationship in CiviCRM between the Staff member and the Volunteer?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T15:22:00.240Z
Comments.Text: We do - they are recorded as 'Link Worker for'. 
  
  I can try the Drupal Stack Exchange - it uses CiviCRM data and the filter is based on CiviCRM relationships.
Comments.UserDisplayName: Rose Lanigan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T15:43:01.917Z
Comments.Text: In that case you should be able to only select the relationships based on the fact that the contact_id_a of the relationship is the logged in user?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T17:02:08.957Z
Comments.Text: Not thought about this before - managed to affect the 'default' value using the relationships, but not filter/restrict the list to only show a smaller list of volunteers. Am I missing something? It's not critical, just trying to make it easier for staff to find the right volunteer.
Comments.UserDisplayName: Rose Lanigan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-02T17:36:38.943Z
Comments.Text: I would need to check to be honest :-) Is it for viewing mainly or do they need to update data? If it is for viewing only I would recommend using Views rather than Webform?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-03T09:23:08.227Z
Comments.Text: You can't filter by relationship in webform_civicrm - I ran into the same thing.  See https://www.drupal.org/node/2797341
Comments.UserDisplayName: Aidan
Tags: <drupal><webform-civicrm><relationships>
Title: Drupal Webforms: Can I use the Conditions to control how the contacts are filtered?
ThreadText: # Drupal Webforms: Can I use the Conditions to control how the contacts are filtered?
  
  (Asked by: username_0 on 2016-11-02)
  
  I have a webform for staff members to record supervision with volunteers, and each staff member has approximately 10 volunteers that they are the named 'Link Worker' for. The webform has a field for the Staff member's name and a field for the Volunteer's name (both using autocomplete so that it allows users to select from contacts already in the database).
  
  My question is, is it possible to filter the volunteer contacts by the Staff Member? (i.e. if we select "John Smith" as the Staff member, can we restrict the volunteers to those who John supervises?)
  
  I think the answer is no, it's not possible, but just wondering if anyone has any suggestions....
  
  **Tags:** drupal, webform-civicrm, relationships
  
  > **Comments:**
  > **username_1**: Your question seems to involve only Drupal and not CiviCRM? If that is the case you will possible get more exposure on the Drupal Questions Stack Exchange site.  
  > **username_1**: Do you use a relationship in CiviCRM between the Staff member and the Volunteer?  
  > **username_0**: We do - they are recorded as 'Link Worker for'.   I can try the Drupal Stack Exchange - it uses CiviCRM data and the filter is based on CiviCRM relationships.  
  > **username_1**: In that case you should be able to only select the relationships based on the fact that the contact_id_a of the relationship is the logged in user?  
  > **username_0**: Not thought about this before - managed to affect the 'default' value using the relationships, but not filter/restrict the list to only show a smaller list of volunteers. Am I missing something? It's not critical, just trying to make it easier for staff to find the right volunteer.  
  > **username_1**: I would need to check to be honest :-) Is it for viewing mainly or do they need to update data? If it is for viewing only I would recommend using Views rather than Webform?  
  > **username_2**: You can't filter by relationship in webform_civicrm - I ran into the same thing.  See https://www.drupal.org/node/2797341  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2017-06-06. Score: 1
  
  We ran into the same issue and didn't want to customise the webform module as it is heavily relied on for a lot of data input and needs to be kept secure and easy to maintain.
  
  So we built a Drupal view displaying the Volunteers based on their relationship to the Staff member (I'm assuming they are related in CiviCRM). When the Staff Member visits the page, it can restricted to show only those the have an active relationship to using a contextual filter to the Drupal User.
  
  This post should help if you've not done this before: [How to create a Drupal View with multiple CiviCRM relationships?](https://civicrm.stackexchange.com/questions/739/how-to-create-a-drupal-view-with-multiple-civicrm-relationships)
  
  We then created a link (using the views Global Text field) to the webform to prepopulate the Volutneer as cid2 or contact 2 (assuming the staff member is cid1) which looks something like this:
  myorganization.org/node/1?cid2=[id] where [id] is the id of the volunteer.
  
  
  ---
  
  