Body: <p>I'm using CiviCRM 5.41.2, CiviRules: Version 2.41, Drupal 7.87</p>
  <p>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.<br />
  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.<br />
  Is using a Hook the only way to do this or am I missing something?
  Thanks for your help!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-16T14:51:39.710Z
Comments.Text: 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.
Comments.UserDisplayName: Joanna S
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-17T18:33:35.880Z
Comments.Text: 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”
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-17T18:45:03.150Z
Comments.Text: 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!
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-08T20:47:27.387Z
Comments.Text: 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
Comments.UserDisplayName: petednz - fuzion
Tags: <webform-civicrm><civirules>
Title: Automated email to user-selected contact with copy of webform and uploaded docs (using CiviRules?)
ThreadText: # Automated email to user-selected contact with copy of webform and uploaded docs (using CiviRules?)
  
  (Asked by: username_0 on 2022-02-08)
  
  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!
  
  **Tags:** webform-civicrm, civirules
  
  > **Comments:**
  > **username_1**: 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  
  > **username_0**: 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.  
  > **username_1**: 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”  
  > **username_1**: 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!  
  
  ---
  
  ## 0 answers
  
  