Required children records

Is there a way to prevent the user to create a parent record without children records, example: I want to prevent the creation of orders without products.

I think in the Valid_If for orders put COUNT([Related Products][ProductID]) > 0.

Yes you can do that with the “Valid If”. You can’t create that functionality directly with the Related virtual column, but you can create that in another column like ISNOTBLANK([Related Child Records])

thanks for your answer, could you be more specific please. I should create a new column with a validif condition but is it a virtual column? or a column with an app formula? I do not understand the details

You don’t need to create any new column to your table if you don’t want… you can use one of your existing normal columns. Let’s say you have 10 normal columns and that one Virtual related list column. If you add that ISNOTBLANK([Related Records]) for example in column #10 and into the option “Valid If”, it will do that job.

1 Like

@Aleksi I’m trying to use this strategy to validate that a child form ISNOTBLANK() when the parent form is submitted, but I haven’t been successful. I’m using the following valid if column constraint for the last real column in my table: ISNOTBLANK([Related TRANSFERS_CAGESs]). Am I doing something wrong? Thanks for your help

Is the result the same if you use COUNT([Related TRANSFERS_CAGESs])?

Why Not just Make the Children “Part of” The parents and show them in the form and set the column required?"

Orders should always have a minimum of 1 product but thats it.

This will take care of that.

Yes that’s true nowadays as Jonathan described. The original post is 1.5 year old and at that moment it didn’t work.

1 Like

Thanks for the recommendation @Jonathan_S. I did have the Children “Part of” The parents, but I’m embarrassed to say that I neglected to set the child column to required. This seems to be working as I hoped now. @Aleksi thanks for your assistance as well

3 Likes

Glad to be of help finally :wink: