Hello,
I have an edit form for a SharePoint list (Payments) and there is a subtable/gallery for another SharePoint list (Payment lines) on the form.
I am trying to patch all gallery items when I click on the save button, however nothing happens, no errors. I have looked a lot of posts and tried to do the same, but no luck.
Could you please advice what I do wrong?
gPaymentLines - Gallery
Payment Request Lines - Data source (SharePoint list), that is used on the gallery.
ForAll(
RenameColumns(
Filter(
'Payment Request Lines',
ID in gPaymentLines.AllItems.ID
),
"ID",
"DD"
),
Patch(
'Payment Request Lines',
LookUp(
'Payment Request Lines',
DD = ID
),
{
Units:"u3",
AccountCode:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cbAccountCode.Selected.ID,
Value: cbAccountCode.Selected.Title
}
}
)
);
This formula should be on the OnSuccess action of your Primary EditForm. Consider changing to the following:
Patch('Payment Request Lines',
ForAll(gPaymentLines.AllItems As _item,
{
ID: _item.ID,
Units: "u3",
AccountCode:{
Id: _item.cbAccountCode.Selected.ID,
Value: _item.cbAccountCode.Selected.Title
}
}
)
);
I hope this is helpful for you.
Hi @RandyHayes thank you for your quick and detailed reply, however it doesn't work for me. I put a message on OnSuccess trigger and I see that the function was called, however nothing happened. I even simplified the formula and kept updating one text field only.
Please see the video how it works.
https://www.screencast.com/t/XjJe7zrr6A
Could you please advise what I am doing wrong?
Thank you for advance.
I was able to patch a single record by hard coding ID
But I still cannot iterate through galley items
What is the Items property of gPaymentLines?
Hi @RandyHayes ,
Gallery Items:
Filter('Payment Request Lines', PaymentRequest.Id=ItemSelected)
The PaymentRequest field is a lookup on the parent list, one PaymentRequest may have some Payment Request Lines.
The filter works good and I can see related rows:
User | Count |
---|---|
259 | |
110 | |
97 | |
57 | |
39 |