
Hi,
I would like to duplicate the same data in 2 lists.
I am able to patch all items in 1st list.
How do i get the new ID from 1st and patch in second list?
First List
| ID | Staff | Department |
| 1 | ABC | HR |
Second List
| primaryID( get from First List) | Activity | Date |
| 1 | Eating | 1/2/2022 |
Hi,
Patch() returns the record created/updated, so you can use this to string together patches to related tables. Eg:
With(
Patch(
SP_Table1,
Defaults(SP_Table1),
{Staff: "ABC", Department: "HR"}
) As ParentRecord,
Patch(
SP_RelatedTable2,
Defaults(SP_RelatedTable2),
{
primaryID: ParentRecord.ID,
Activity: "Eating",
Date: Date(2022, 1, 2),
}
)
)
I hope you can adjust this to suit your needs, I have obviously hard-coded some values for demonstration.