New record that has a field list of custom types in one step

I’m trying to build a form that creates a new user. One of the fields for the user is a custom data type called “Family Members” that is a list of Family Members. The Family Member data type consists of First Name, Last Name, Date of Birth, and Relationship (which is pointed to an option set consisting of choices like “Spouse”, “Son”, “Daughter”, etc.). Essentially what I want to do is create a list of family members of the user that may be of any arbitrary number of entries.

I tried to do this by creating two custom states on my entry page. The first is a single “Family Member” data type. The second is a list of Family Members. I then had a repeating group on the page linked to the custom state list of Family Members (for display purposes). I also had four entry fields for the four fields on a Family Member. When I click a button I set up a two-step workflow that Makes Changes to a Thing by mapping the four entry fields to the single Family Member custom state and then secondarily adds that Family Member custom state to the list of Family Members custom state (and subsequently displayed in the repeating group). On submission of the new user form, it should take that list of Family Members to populate the user’s Family Members list.

Ideally, I create a new user called John Doe. I type out his name, and then can add Jane Doe, Mary Doe, and Bob Doe as family members. When I save out the John Doe user it also creates the three family member records for Jane, Mary, and Bob, and puts their records in the list of Family Members in John’s user record.

I can actually set this up in the interface and there are no issues or errors, except it doesn’t work. Stepping through the workflow, it appears that the data from the entry fields exists but never populates the single custom state Family Member type and thus never adds anything to the Family Member list.

Clearly I’m doing something wrong. Is there a way to fix this, or is there a better way to do a one-step entry of this type where you’re doing an insert into an object that may have a field that is a list of multiple other objects that are also new?

1 Like

Hello!

A family member needs to be created in the dB first. Once it exists you can use that entry with custom states. It seems that you are attempting to create “ghost” family members that only “exist” in the browser via custom states.

Change your flows to have the first action being the creation of a family member first and in later steps of the flow to add him/her to other objects that exist in the database.

You can certainly use custom states lists. Just make sure that whatever you add to these browser lists (that is what a custom state list is) have actual dB records added to them, so that then you use those browser lists to SET THE LIST of a dB object (i.e. an actual family member or members that is/are added to the list of family members of another actual family member).

Hope this makes sense.

Best of luck with your app :+1:t2:

Thanks for that response. I was starting to lean toward figuring that I needed the family members to be created either before (in which case they might be orphaned if the user creation doesn’t finish or is canceled) or after, which would take an additional step. Thanks for confirming how that works!

1 Like