I have a contact form currently set up with select options for the nature of the customer's inquiry. The conditionals and email handlers are set up for each selection value. Just now the user has to manually select a subject from the drop down before it displays the corresponding fields. Is it possible to take the user to the form using a parameter in the URL based on the selection option value so all the relevant fields are shown? I have tried using variants and references to show the fields and display them in webform nodes but I wondered what was the best way to go about this as I cannot get the fields to hide using variants. I'm still new to variants so still working all of that out. I have looked through the previously asked questions but I can't find anything for Drupal 8.
If I'm understanding correctly, you want to show/hide certain fields based on the value of the Subject field, and you also want this value to have the ability to be set via a URL parameter?
If that's the case, this can be done in a single form using conditional fields and form settings.
First, in your form Settings, under Form >> Form Behaviors >> Prepopulate, check
Allow all elements to be populated using query string parameters.
If this is checked, all elements can be populated using query string parameters. For example, appending ?name=John+Smith to a webform's URL would set the 'name' element's default value to 'John Smith'. Please note that individual elements can also have prepopulation enabled, so you could skip this and allow only the Subject field to be prepopulated if desired.
Next, in "Build" screen, edit one of the conditional fields that depend on the Subject field value. In the "Conditions" tab, you can describe the logic to display or hide the field based on the value of another field, something like
All of the following is met:
'Some subject value'
I hope I've understood your question correctly! While it doesn't use 'variants', this approach can still help you show a variation of your form depending on how the "Subject" field is filled.