5

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?

6

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

  • 1
    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). – Laryn - CEDC.org Jan 28 '16 at 21:00
  • provided the fields are all set to existing contact then i am not clear what the risk is – petednz - fuzion Jan 29 '16 at 3:28
  • 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. – Laryn - CEDC.org Jan 29 '16 at 3:47
  • Instead of disabling permission checks, you can enable the Relationship Permission ACL 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). – Coleman Feb 2 '16 at 0:14
  • if that doesn't work when using checksum then it might be related to this drupal.org/node/2406823 – petednz - fuzion Feb 2 '16 at 4:13
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 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 Coleman's comment on this question: Displaying a Views block with a CiviCRM-enabled webform, the code snippet above is an example of how to do it.

  • 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.") – Laryn - CEDC.org Jan 28 '16 at 20:12
  • I suppose I could create custom tokens to duplicate the spouse/child IDs and checksums for the primary contact... – Laryn - CEDC.org Jan 28 '16 at 20:15
  • Ah! Didn't see that note. Tricky... :) – Allen Hutchison Jan 28 '16 at 20:16
  • 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? – Allen Hutchison Jan 28 '16 at 20:17
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.

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

  • 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. – Laryn - CEDC.org Jan 28 '16 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.