cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jimmydebie
Regular Visitor

Problem patching SP lists with nested table

I have a form where people can request articles to be shipped.

The form has 2 main datasources, a list called "TA Shipment REQ2" and a list called "Test article details".

 

The form is spread over 4 screens.

On one screen, the user can add multiple articles:

Collectioncreation.JPG

 

Add article, creates the collection:

OnSelect:ClearCollect(TestArticleCollection, {TestArticleItem: "", TiterItem: "", BatchNumberItem: "", DosesItem: 0, NumberofVialsItem: 0, ShelfLifeItem: "", PackagingItem: ""})

 

Save button:

OnSelect: 

Patch(
TestArticleCollection,
ThisItem,
{
TestArticleItem: TestArticleItem.Text,
TiterItem: TiterItem.Text,
BatchNumberItem: BatchNumberItem.Text,
DosesItem: Value(DosesItem.Text),
NumberofVialsItem: Value(NumberofVialsItem.Text),
ShelfLifeItem: ShelfLifeItem.Text,
PackagingItem: PackagingItem.Text
}
);
Collect(
TestArticleCollection,
{
TestArticleItem: "",
TiterItem: "",
BatchNumberItem: "",
DosesItem: 0,
NumberofVialsItem: 0,
ShelfLifeItem: "",
PackagingItem: ""
}
)

Updates the collection with the new data.

 

On the last screen, I want the user to be able to save the request to the main SP list "TA Shipment REQ2" and at the same time, save the articles to the other list, where the MasterID column should correspond with the ID column of the "TA Shipment REQ2" list.

submit.JPG

OnSelect: 

Patch('TA Shipment REQ2',Defaults('TA Shipment REQ2'),StudyInfo.Updates,StudyPaperWorkAttachments.Updates,StudyPaperWorkType.Updates,StudyPaperWork.Updates,GMPForm.Updates,TASenderInfo.Updates,TARecipientInfo.Updates)

 

To write the article data back to it's SP list, I've added following to the form on my last screen, where the Submit button resides:

 

OnSuccess: 

ForAll(
TestArticleCollection,
Patch(
'Test article details',
Defaults('Test article details'),
{
'Test Article/Material required': TestArticleItem,
Titer: TiterItem,
'Batch number': BatchNumberItem,
'Doses required': DosesItem,
'Number of Vials required': NumberofVialsItem,
'Required Minimal Shelf Life': ShelfLifeItem,
'Packaging (blister, box, number of vials per unit. ex.: 8 vials per box)': PackagingItem,
MasterID: StudyInfo.LastSubmit.ID
}
)
)

 

My main data is saved to the SP list "TA Shipment REQ2", what I can't get to work is having the additional article data saved to the other SP list "Test article details".

 

All help would be appreciated here, struggling on this since a while.

1 ACCEPTED SOLUTION

Accepted Solutions

@v-siky-msft 

Thanks for the suggestion.

 

I resolved it in creating a tabbed form (based on https://www.youtube.com/watch?v=if_mFIfi5PM) , this way I could submit 1 form and at the same time patch the nested table.

I didn't have issues with the LastSubmitted.ID part, didn't change this in my new form and worked.

 

Kind regards

Jimmy

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

Hi @jimmydebie ,

 

What is the data type of MasterID column? Is it LookUp column, right?

If so, Please modify the code as follows.

ForAll(
TestArticleCollection,
Patch(
'Test article details',
Defaults('Test article details'),
{
'Test Article/Material required': TestArticleItem,
Titer: TiterItem,
'Batch number': BatchNumberItem,
'Doses required': DosesItem,
'Number of Vials required': NumberofVialsItem,
'Required Minimal Shelf Life': ShelfLifeItem,
'Packaging (blister, box, number of vials per unit. ex.: 8 vials per box)': PackagingItem,
MasterID: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: StudyInfo.LastSubmit.ID,
Value: StudyInfo.LastSubmit.ID
}
}
)
)

Hope this helps

Sik

@v-siky-msft 

Thanks for the suggestion.

 

I resolved it in creating a tabbed form (based on https://www.youtube.com/watch?v=if_mFIfi5PM) , this way I could submit 1 form and at the same time patch the nested table.

I didn't have issues with the LastSubmitted.ID part, didn't change this in my new form and worked.

 

Kind regards

Jimmy

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,112)