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(
{NewRecordSmiley Tongueatch(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})

    {NewRecordSmiley Tongueatch(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), 
{ReservedByEmailSmiley Very HappyataCardValue3.Text,
ReservedUntilSmiley Very Happyate,
Title:BookNameField,
Person's NameFieldSmiley TongueersonName})

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( {NewRecordSmiley Tongueatch(Inventory,First(Filter(Inventory,Title=checkedout.Title)), {CountValue:If(checkedout.CountValue>0,checkedout.CountValue-1,checkedout.CountValue)})});
Patch(UserCheckout, Defaults(UserCheckout), {ReservedByNameSmiley Very HappyataCard2.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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 150 members 3,748 guests
Please welcome our newest community members: