2

Summary

This is a follow up question of that one, that I asked a year ago when FormBuilder was not as advanced as today. There was no easy solution, now there is almost one, so a big thx and congrats to the FormBuilder developpers :)

Our use case is probably very common : a form where a parent can fill in his own data and the data of his two children, with "parent of / child of" relationships.

We would like the names and data of the parent and related children to be auto-filled, if already present in Civicrm, and this is where we are failing for the second child.

  • Parent autofill : ok
  • Child 1 autofill : ok
  • Child 2 autofill : NOT ok, it is autofilled with the data of Child 1 :(

Details

This form seems to work as expected to create new parent and children from a blank form

enter image description here

Then we use the email token in Civimail, so that existing Parents can update their data and children.The email token is {afform.afformTestLink}

enter image description here

Autofill is working ok for the parent, and one child

For Parent1 :

enter image description here

For Child 1: "child of / current user" enter image description here

For Child 2: same as child 1, although the parent as 2 different children already related to him in civicrm

enter image description here

PROBLEM

child 2 is autofilled with the same data as child 1 :(

2 Answers 2

2

Well articulated question! I noticed in your screenshot that you have 2 child entities on the form. They are both being filled in the same way, so they both get the same result. Not what you want, but I understand why the computer would do that 🤖.

I think you might get your desired result if you only have 1 child entity on the form, and make it a repeating entity. If you still want a maximum of 2 you can configure a limit to the repeat setting.

3
2

The answer of @Coleman above was perfect, I could even do more than expected. Detailed solution below.

Tabs in the form :

  • parents
  • related children
  • relationship

Related children are autofilled as "Child of current user", and made a repeating entity

enter image description here

enter image description here

Parents are autofilled as "Parent of related children", and also repeating entity. With this trick, we get the data of the other parent :)

enter image description here

Your Answer

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

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