I'm using CiviCRM 5.41.2, CiviRules: Version 2.41, Drupal 7.87

I am trying to create a webform where the user submits a number of documents. They also select their region from a drop down list, triggering a conditional that displays a listbox of organisations tagged with that region and they would select one of these from the list. What I would like to do is send the submitted documents to the selected organisation and a copy of the webform. I could do this through a conditional I think but if any organisation changed their email address, it would need changing in the conditional. I would prefer if the process was accessing the current email from the organisation's database entry.
I do not want to display the email address of the selected organisation to the user which would enable this to work I think. If there is a hidden email field for the organisation, when the user submits the webform, they wipe the organisation's stored email address - I guess because the field is considered empty unless it is displayed? I have had a look at CiviRules but can't figure out a way of either attaching a document to the template or copying a submitted webform as part of the action. I think what I'm trying to do may be possible using Hooks but setting that up may be beyond my skills.
Is using a Hook the only way to do this or am I missing something? Thanks for your help!

  • just thinking through the webform options, could you add your Orgs as additional contacts on the webform, then rejig them to be select fields, that way person could tick which Orgs it should go to. (you may also need a conditional fieldsets if you need to show A1, A2 and A3, if someone selects region A, and B1, B2 and B3 if they choose region B, etc
    – petednz - fuzion
    Commented Feb 8, 2022 at 20:47
  • Thank you for your response. I think the problem is if I am adding an org contact in order for the email field to be automatically populated when the org is selected, it needs to be an 'Existing contact' field. If the email field is then hidden, it is not recognised once the form is submitted so the notification does not get to the target and the name and email address listed on the org's entry are wiped. The existing contact autofill does not seem to apply to hidden fields. I cannot expose the email field to the user so I'm a bit stuck about what else to try.
    – Joanna S
    Commented Feb 16, 2022 at 14:51
  • hmm yes think we have hit that issue, and worked around it by not setting Email as hidden or private and instead used a CSS Class on the email field “element-invisible”
    – petednz - fuzion
    Commented Feb 17, 2022 at 18:33
  • also just a warning, with email set as Private it can result in existing email address being overwritten by empty field - sorry to have not remembered that. so when testing, keep checking that your Org still has an email address!
    – petednz - fuzion
    Commented Feb 17, 2022 at 18:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.