Answers.Body: <p>If you use an Existing Contact field for the other contacts, you can include their contact IDs in the URL arguments with something akin to this: <code>/your-link?cid1=[id]&amp;cid2=[id]&amp;cid3=[id]</code></p>
  
  <p>Though it's not as clear as it could be, the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration#WebformCiviCRMIntegration-AutofillingFormsfromURLArguments" rel="nofollow noreferrer">Webform-CiviCRM documentation</a> hints at multiple contacts getting pre-loaded, and notes the requirement of the Existing Contact fields for each (you can hide the EC fields), but doesn't show how. Per <a href="https://civicrm.stackexchange.com/questions/8444/displaying-a-views-block-with-a-civicrm-enabled-webform#comment8197_8445">Coleman's comment</a> on this question: <a href="https://civicrm.stackexchange.com/q/8444/105">Displaying a Views block with a CiviCRM-enabled webform</a>, the code snippet above is an example of how to do it. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:12:51.997Z
Answers.Text: Thanks, Allen! Ideally I'd like this form to prefill automatically (without relying on the specialized URL) but this could be a plan B. Problem is permissions don't allow cid2 or cid3 to prefill, and besides we can't get the ID or Checksum for those contacts from CiviMail. ("Note: CiviMail links will only work for contact 1, so set up your form appropriately so that contact 1 represents the contact to be autofilled.")
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:15:45.067Z
Answers.Text: I suppose I could create custom tokens to duplicate the spouse/child IDs and checksums for the primary contact...
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:16:04.103Z
Answers.Text: Ah!  Didn't see that note.  Tricky... :)
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:17:33.913Z
Answers.Text: From the next section down in the documentation: "Generating a checksum from views is slightly more complex and requires adding a php snippet to your view output."  Not sure what the process would be there but perhaps something there?
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:01:48.050Z
Answers.LastActivityDate: 2016-01-28T20:01:48.050Z
Answers.LastEditDate: 2017-04-13T12:53:13.207Z
Answers.UserDisplayName: Allen Hutchison
Answers.Body: <p>One way to do it is using the checksum and cid tokens in the URL as mentioned in the other posts.</p>
  
  <p>If you don't want to be limited to users needing you to send them the URL in order to access the form, there is another way using the relationship-permission extension here : <a href="https://civicrm.org/extensions/relationship-permissions-acls" rel="nofollow">https://civicrm.org/extensions/relationship-permissions-acls</a></p>
  
  <p>The extension will create ACL permissions based on the relationship permission (the relationship permissions are usually only to access the contact's dashboard.)</p>
  
  <p>You can set the first 'existing user' as the current logged in user and for every other contact, set 'existing user' to auto-fill or select list. Make sure that 'enforce permission' is enabled in the 'existing contact field'. If the logged in user has the permissions set to edit those he's related to, he will be able to select then in the webform and will not have access to any other contact.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-29T05:04:27.653Z
Answers.LastActivityDate: 2016-01-29T05:04:27.653Z
Answers.UserDisplayName: Yossi
Answers.Body: <p>In webforms we have an option called checksum - In Civicrm Tab
  <strong>Enable CiviCRM Processing</strong></p>
  
  <p>This will generate an Link in the <strong>Additional Option Tab</strong> which will generate an link for sending to each member monthly for renewal - I guess this might help you </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T19:38:57.127Z
Answers.Text: This will pre-fill the first contact on the webform, but if there are additional contacts (in this example, a spouse and a child), their info doesn't get pre-filled.
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T16:43:01.723Z
Answers.LastActivityDate: 2016-01-28T16:43:01.723Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.Body: <p>If you have the Spouse and the Child set up with Relationships - and you configure the webform to have 3 contacts, and you set the contact 2 "Existing contact" webform component to have a 'default value' based on 'relationship to contact 1' then I would expect that using a checksum for contact 1 should result in those other contacts being prefilled. Is that what you need?</p>
  
  <p><a href="https://i.sstatic.net/01jlq.jpg" rel="noreferrer"><img src="https://i.sstatic.net/01jlq.jpg" alt="Default value by relationship"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T21:00:56.617Z
Answers.Text: Pete, not sure how I missed this option before -- it is almost all the way there. In order for the pre-fill to occur, I need to uncheck "Enforce Permissions" which makes me a little nervous. Should it? (BTW, I tested even with the primary contact relationship having permission to edit the second contact and it still doesn't prefill).
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-29T03:28:44.200Z
Answers.Text: provided the fields are all set to existing contact then i am not clear what the risk is
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-29T03:47:43.203Z
Answers.Text: I'm fairly sure it's secure but just trying to be 100% certain. It's a static widget, not an autocomplete field in this case and I'm not allowing them to pass IDs in the URL, so they can't pull up other contacts' info by inserting IDs in the URL... should be okay, I think. If anyone else sees another potential issue here I'd love to know.
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-02T00:14:36.830Z
Answers.Text: Instead of disabling permission checks, you can enable the [Relationship Permission ACL](https://civicrm.org/extensions/relationship-permissions-acls) extension and then the first contact will have permission granted via relationships (see notes on the extension about manually or auto-setting the permission flag on the relationship).
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-02T04:13:27.487Z
Answers.Text: if that doesn't work when using checksum then it might be related to this https://www.drupal.org/node/2406823
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-29T15:38:42.200Z
Answers.Text: @petednz-fuzion: you saved my week-end!!! thanks
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-29T22:26:30.910Z
Answers.Text: thx for letting me know :-)
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:41:22.520Z
Answers.LastActivityDate: 2016-01-28T21:48:08.690Z
Answers.LastEditDate: 2016-01-28T21:48:08.690Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>We have a webform that allows a contact to sign up for a membership and specify two related contacts (let's say "Spouse" and "Child" for the example).</p>
  
  <p>When they come back to renew, we can prefill the contact's info via a checksum token in a link from CiviMail (or automatically if they are logged in) -- but is there a way to prefill the other related contacts as well, so they don't add duplicates when they renew?</p>
  
Tags: <drupal><webform-civicrm><relationships>
Title: Allowing a contact to update their related contacts via Webform-CiviCRM
ThreadText: # Allowing a contact to update their related contacts via Webform-CiviCRM
  
  (Asked by: username_0 on 2016-01-28)
  
  We have a webform that allows a contact to sign up for a membership and specify two related contacts (let's say "Spouse" and "Child" for the example).
  
  When they come back to renew, we can prefill the contact's info via a checksum token in a link from CiviMail (or automatically if they are logged in) -- but is there a way to prefill the other related contacts as well, so they don't add duplicates when they renew?
  
  **Tags:** drupal, webform-civicrm, relationships
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_4 on 2016-01-28. Score: 8 | Accepted answer
  
  If you have the Spouse and the Child set up with Relationships - and you configure the webform to have 3 contacts, and you set the contact 2 "Existing contact" webform component to have a 'default value' based on 'relationship to contact 1' then I would expect that using a checksum for contact 1 should result in those other contacts being prefilled. Is that what you need?
  
  [![Default value by relationship](https://i.sstatic.net/01jlq.jpg)](https://i.sstatic.net/01jlq.jpg)
  
  > **Comments:**
  > **username_0**: Pete, not sure how I missed this option before -- it is almost all the way there. In order for the pre-fill to occur, I need to uncheck "Enforce Permissions" which makes me a little nervous. Should it? (BTW, I tested even with the primary contact relationship having permission to edit the second contact and it still doesn't prefill).  
  > **username_4**: provided the fields are all set to existing contact then i am not clear what the risk is  
  > **username_0**: I'm fairly sure it's secure but just trying to be 100% certain. It's a static widget, not an autocomplete field in this case and I'm not allowing them to pass IDs in the URL, so they can't pull up other contacts' info by inserting IDs in the URL... should be okay, I think. If anyone else sees another potential issue here I'd love to know.  
  > **username_5**: Instead of disabling permission checks, you can enable the [Relationship Permission ACL](https://civicrm.org/extensions/relationship-permissions-acls) extension and then the first contact will have permission granted via relationships (see notes on the extension about manually or auto-setting the permission flag on the relationship).  
  > **username_4**: if that doesn't work when using checksum then it might be related to this https://www.drupal.org/node/2406823  
  > **username_6**: @petednz-fuzion: you saved my week-end!!! thanks  
  > **username_4**: thx for letting me know :-)  
  
  ---
  
  ### Answer by username_1 on 2016-01-28. Score: 3
  
  If you use an Existing Contact field for the other contacts, you can include their contact IDs in the URL arguments with something akin to this: `/your-link?cid1=[id]&cid2=[id]&cid3=[id]`
  
  Though it's not as clear as it could be, the [Webform-CiviCRM documentation](http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration#WebformCiviCRMIntegration-AutofillingFormsfromURLArguments) hints at multiple contacts getting pre-loaded, and notes the requirement of the Existing Contact fields for each (you can hide the EC fields), but doesn't show how. Per [username_5's comment](https://civicrm.stackexchange.com/questions/8444/displaying-a-views-block-with-a-civicrm-enabled-webform#comment8197_8445) on this question: [Displaying a Views block with a CiviCRM-enabled webform](https://civicrm.stackexchange.com/q/8444/105), the code snippet above is an example of how to do it.
  
  > **Comments:**
  > **username_0**: Thanks, Allen! Ideally I'd like this form to prefill automatically (without relying on the specialized URL) but this could be a plan B. Problem is permissions don't allow cid2 or cid3 to prefill, and besides we can't get the ID or Checksum for those contacts from CiviMail. ("Note: CiviMail links will only work for contact 1, so set up your form appropriately so that contact 1 represents the contact to be autofilled.")  
  > **username_0**: I suppose I could create custom tokens to duplicate the spouse/child IDs and checksums for the primary contact...  
  > **username_1**: Ah!  Didn't see that note.  Tricky... :)  
  > **username_1**: From the next section down in the documentation: "Generating a checksum from views is slightly more complex and requires adding a php snippet to your view output."  Not sure what the process would be there but perhaps something there?  
  
  ---
  
  ### Answer by username_2 on 2016-01-29. Score: 2
  
  One way to do it is using the checksum and cid tokens in the URL as mentioned in the other posts.
  
  If you don't want to be limited to users needing you to send them the URL in order to access the form, there is another way using the relationship-permission extension here : <https://civicrm.org/extensions/relationship-permissions-acls>
  
  The extension will create ACL permissions based on the relationship permission (the relationship permissions are usually only to access the contact's dashboard.)
  
  You can set the first 'existing user' as the current logged in user and for every other contact, set 'existing user' to auto-fill or select list. Make sure that 'enforce permission' is enabled in the 'existing contact field'. If the logged in user has the permissions set to edit those he's related to, he will be able to select then in the webform and will not have access to any other contact.
  
  
  ---
  
  ### Answer by username_3 on 2016-01-28. Score: 0
  
  In webforms we have an option called checksum - In Civicrm Tab
  **Enable CiviCRM Processing**
  
  This will generate an Link in the **Additional Option Tab** which will generate an link for sending to each member monthly for renewal - I guess this might help you
  
  > **Comments:**
  > **username_0**: This will pre-fill the first contact on the webform, but if there are additional contacts (in this example, a spouse and a child), their info doesn't get pre-filled.  
  
  ---
  
  