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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,357)