cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
zebraffe_x
Level: Powered On

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
Community Support Team
Community Support Team

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.
zebraffe_x
Level: Powered On

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.

zebraffe_x
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,717)