Hi
So a few things to talk about. Well first thank you for posting your code :-) that helps. The new Viewer is BAD so if you look at your post nothing is wrapped so I had to copy it out to even read it (not your fault)
So here is your code cleaned up
1) you should NOT put your submit and your Forall in the same place. Why? because if the Submitform fails, you are going to be linking non-existing parent records.
You should use the OnSuccess property of the Form to do your ForAll
Or use the OnError to log that the parent failed, but now you dont have missing parents / children
2) I have no idea what you are trying to do in your forall, none of this code is valid but going by what you told me its different than what you are trying to do.
Let me explain what your code is trying to do
Loop through a Collection called Collection 1, that you are creating for the ... not sure what CurrentItem is
And then you immediately do a Patch, but your patch isn't using any data from the Collection, just the form so let's do this again (see below)
3) However, its incredibly important if you want us to tell what you are doing wrong you have to share a picture (at least) of the Code Errors, because if you are having Value / field issues, we need to know which ones and for each one, tell us the Field Type in SharePoint/Dataverse so we can figure it out. Right now you are converting everything to a number.
SubmitForm(Form1);
ForAll(ClearCollect(Collection1,CurrentItem),
Patch(ECI_Dies,
Defaults(ECI_Dies),
{
ECI_ID:Value(SelectedRecordTitle1.Text),
Product:Value(DataCardValue9.SelectedText),
ECI_Level:Value(DataCardValue3.Text),
'Trial?':Value(DataCardValue2.SelectedItems),
Cavity:Value(DataCardValue1.SelectedItems),
Content:Value(DataCardValue4.Text),
DieNum:Gallery2.Selected
}
)
);
//In your button OnSelect
SubmitForm(Form1);
// In your OnSuccess of the Form1
// FIRST it seems like you expect to patch multiple records, but can you explain exactly
where they come from (like a picture, code, something)
1) From the Form, you only have 1 record, but then you have multiple "Parts" in another Gallery
2) Are you really creating multiple records from the Gallery2 selections or from parts in Form1
or will Form1 create multiple Child record and the child records use some of the gallery data?
If Gallery 2 is the master list of child records and parts are coming from Form1 (maybe even
duplicated across each child record then do this)
ForAll(Filter(Gallery2.AllItems, SomeFieldChecked.Value = true),
Patch(ECI_Dies,
Defaults(ECI_Dies),
{
FieldFilledWithGallery2Data: ThisRecord.FieldName.Value or whatever,
FieldFilledWithForm1Data: Value(SelectedRecordTitle1.Text)
}
)
);