Hi all,
Hoping someone can point me in the right direction here with a small issue regarding patching an entire collection to Dataverse.
I have a multi select gallery were the user can select more than one item. As such I am attempting to patch an entire collection to a dataverse table.
The issue I am having is with my second ForAll() that performs the actual patch.
I collect all items in the gallery in the first ForAll(), but when I patch to the datasource, what I end up with is three duplicate values.
For context, my testing was performed with 3 records in the collection, but instead of creating three unque rows, I get 3 duplicate rows of the first record in the collection. Hope that makes sense.
Has anyone ran into the same issue before, if so, any tips?
My code:
//Create transfer record
Set(
varTransferRunOutput,
Patch(
Transfers,
Defaults(Transfers),
{
Destination: LookUp(
Sites,
Name = First(
Split(
varInternalScan,
","
)
).Result
),
'Provided By': LookUp(
Accounts,
Account = GUID("ee2cce64-7459-eb11-a812-00224840faa6")
),
Account: LookUp(
Accounts,
Account = cmbInternalAccount.Selected.Account
),
Route: 'Route (Transfers)'.Internal,
Date: Now()
}
)
);
//Create collection for all gallery items
ForAll(
galInternalItem.AllItems,
Collect(
colInternalItemRun,
{
Transfer: LookUp(
Transfers,
Transfer = varTransferRunOutput.Transfer
),
Account: cmbInternalAccount.Selected.Account,
Item: GUID(lblInternalItemGUID.Text),
Count: Value(txtInternalItemTransferQty.Text),
'Source Location': lblSourceLocationGUID.Text,
Status: 'Status (Transfer Items)'.Active
}
)
);
//Patch all collection records to Transfer Items table
ForAll(
colInternalItemRun,
Patch(
'Transfer Items',
{
Transfer: LookUp(
Transfers,
Transfer = varTransferRunOutput.Transfer
),
Account: LookUp(
Accounts,
Account = cmbInternalAccount.Selected.Account
),
Item: LookUp(
Devices,
Device = GUID(lblInternalItemGUID.Text)
),
Count: Value(txtInternalItemTransferQty.Text),
'Source Location': LookUp(
Sites,
Site = GUID(lblSourceLocationGUID.Text)
)
}
)
);
Three duplicate values from Patch statement:

Many thanks!
Frank