Filter webform dropdown through relationship type
This ticket is targeted at improving the data filtering capabilities of the ‘Existing Contact’ field of the Webform CiviCRM.
With this new filtering - we will be able to filter the existing contact field with values derived from a particular relation type that a contact has with another contact.
How it works currently: Currently we have the ability to filter through Groups and Tags
We also currently have the ability for the existing contact field on the webform to autoload static value through a predefined relationship to another ‘existing contact’ field on the webform.
i.e. If Contact 1 is the Case Client and has a relationship: ‘Employee of’ with Ashville School, we can add another contact field on the webform and enable the relationship fields on it to: ‘Employee of’.
We will also have to edit the ‘Existing Contact’ field and select it’s default value to load from a relationship.
This would mean that Contact 2 on the webform will be the value coming from the ‘Employee of’ relationship with Contact 1 (in this case - for our selected case client - it would be ‘Ashville School’)
In this way we are able to load the value from a relationship that 2 contacts have, however, we can not do this dynamically.
I.e. Contact 3 (another contact on the webform) cannot be set to filter and give back a list of all the students at Ashville School (have a relationship ‘Student at’ with ‘Ashville School’, so that the user filling the form can select one of the students.
How we would like to improve the functionality: With this new implementation, we will be able to filter values for an ‘Existing Contact’ field on the webform through specifying a relationship and relationship with.
Continuing from our previous example where:
Contact 1 - Joe Bloggs (Case Client) Contact 2 - Ashville School (Has the relationship ‘Employer of’ with Joe Bloggs) Contact 3 - We need a list of all students at Ashville School and be able to select this on the form
To achieve this - we will need the following configurations in the filters section of the ‘Existing Contact’ field:
In the above example, the user will be able to select: Relationship Type - ‘Student at’ Contact - ‘Contact 2’
This would mean when the webform loads, it will populate all the students at Contact 2 (Ashville School) as option values for Contact 3.