3

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....

  • 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. – ErikH - CiviCooP Nov 2 '16 at 15:16
  • Do you use a relationship in CiviCRM between the Staff member and the Volunteer? – ErikH - CiviCooP Nov 2 '16 at 15:16
  • 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. – Rose Lanigan Nov 2 '16 at 15:22
  • 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? – ErikH - CiviCooP Nov 2 '16 at 15:43
  • 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? – ErikH - CiviCooP Nov 2 '16 at 17:36
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?

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.

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.