cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Asset Checkout not updating in 2nd SharePoint list

I'm trying to build an app that will track books. I want to track who is checking out which book and when they checked it back in. I'm using the Asset Checkout template as a guide and I have 2 SharePoint lists as my data sources: Inventory and UserCheckout.

 

What I want to happen is, when someone checks out a book, let's call it Alphabet for Dummies, I want the CountValue column to reduce by 1 (# available) in the Inventory list and I want to add a record in the UserCheckout list with the person's Name, ReservedUntil (Due Date), (Book) Title, and Email.

 

I've managed to get the flow working in the sense that all the buttons work with no errors and I have the 'CountValue' in Inventory reducing when I go through with the process of checking out a book. Where I'm having an issue is that a record isn't being added to the UserCheckout list. I tried patching the lists so that when I hit Submit, it would update both lists but I keep getting an error.

 

This is what I already have:

SubmitForm(ReservedForm);Navigate(ConfirmationScreen,ScreenTransition.Fade,{checkedout:checkedout});UpdateContext(
{NewRecord:Patch(Inventory,First(Filter(Inventory,Title=checkedout.Title)),
{CountValue:If(checkedout.CountValue>0,checkedout.CountValue-1,checkedout.CountValue)})});
Navigate(ConfirmationScreen,ScreenTransition.None)

 

And this is how I've tried patching: 

Patch(UserCheckout, Defaults(UserCheckout), {ReservedByEmail=DataCard3})

    {NewRecord:Patch(Inventory,First(Filter(Inventory,Title=checkedout.Title)),

        {CountValue:If(checkedout.CountValue>0,checkedout.CountValue-1,checkedout.CountValue)})});

    Navigate(ConfirmationScreen,ScreenTransition.None)

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Asset Checkout not updating in 2nd SharePoint list

Hi @zebraffe_x,

 

The patch() furmula in your second formula will not work.

Patch(UserCheckout, Defaults(UserCheckout), {ReservedByEmail=DataCard3})

    {NewRecord:  Patch(Inventory,First(Filter(Inventory,Title=checkedout.Title)),

        {CountValue:If(checkedout.CountValue>0,checkedout.CountValue-1,checkedout.CountValue)})});

    Navigate(ConfirmationScreen,ScreenTransition.None)

 

The correct format should be:

Patch(UserCheckout, Defaults(UserCheckout), 
{ReservedByEmail:DataCardValue3.Text,
ReservedUntil:Date,
Title:BookNameField,
Person's NameField:PersonName})

For how to use patch, see:

Patch() in PowerApps

 

Let me know if that would work.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Asset Checkout not updating in 2nd SharePoint list

Hi @v-micsh-msft,

 

Thanks for reaching out. I tried your solution but I'm still getting an error. This is all the code that I have in the OnSelect button, which should submit the form and update/populate both lists:

SubmitForm(ReservedForm);
Navigate(ConfirmationScreen,ScreenTransition.Fade,{checkedout:checkedout});
UpdateContext( {NewRecord:Patch(Inventory,First(Filter(Inventory,Title=checkedout.Title)), {CountValue:If(checkedout.CountValue>0,checkedout.CountValue-1,checkedout.CountValue)})});
Patch(UserCheckout, Defaults(UserCheckout), {ReservedByName:DataCard2.Text});

I highlighted in red where the error is that I'm getting. I also tried using DataCardValue#.Text and I even tried taking out the .Text but I'm still getting an error. The error I'm getting when I hover over .Text is Invalid name

 

I've read through that Patch() article but I'm still a little confused as to how to get it working how I need it to, hence how I ended up with my original code.

Highlighted
Frequent Visitor

Re: Asset Checkout not updating in 2nd SharePoint list

I tried your solution but I'm getting an error (in previous reply). Do you have any suggestions on what I can do or why it's not working?

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,101)