cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Powerapp does not update sharepoint list after app closing

Hello,

 

I have created an app that have two screens: 

- first that shows picture, name and phone number (using Office365user add-in)

- second with possibility of check in and check out

 

The app is connected to a sharepoint list and everything works correctly if i have the app opened and i click check in, my profile appears on the first screen, if i click check out, my profile dissapear but when I click check in and then close the app and open it again, the check out button does not work and does not update the data, so even though I click it, the data is still visible and sharepoint list does not update.

 

I used the following code in the check out button:

OnSelect: Refresh('Sharepoint List');; If(!IsBlank(CurrentCheckedInRecord); Patch('Sharepoint List';CurrentCheckedInRecord;{CheckOut:Now()}));; Navigate(MainScreen;ScreenTransition.Fade)

DisplayMode: If(
    !IsBlank(LookUp('Sharepoint List'; StaffEmail=varUserEmail And CheckOut=Blank()));
    DisplayMode.Edit;
    DisplayMode.Disabled)

 

Could you please support why the checkout button does not update my sharepoint list after the app is closed?

 

Many thanks in advance!!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Post Prodigy
Post Prodigy

Re: Powerapp does not update sharepoint list after app closing

Hi @Bartek1 ,

 

There are some changes, in your display and OnSelect Codes.

 

First of All, what I did I am storing a status in SP List, like if someone checks in, then it will Store "IN"  in the Status Column, and when the user checks out it will patch the column with Out, which means the user checked out that day.

This will help you to configure your display code and OnSelect code according to that.

So,
Steps:

1)  Create a column in your SP List, Status and set the column as Single Line Text.
2) you have to update your Check in Code, Like this

Check IN > OnSelect

 

Patch('Sharepoint List'; Defaults('Sharepoint List');{
Title:"Employee",
StaffFullName:User().FullName,
StaffEmail:User().Email,
Check_x0020_In:Now(),
Status: "IN"
}
);
 Navigate(MainScreen;ScreenTransition.Fade)

 

Check IN > Display Mode:

 

If(!IsBlank(LookUp(Sharepoint List,Email Column Name =varUserEmail And Status="IN" )),DisplayMode.Disabled,DisplayMode.Edit)

 


CheckOUT > OnSelect

 

Refresh('Sharepoint List');

If(
 CountRows(Filter( Sharepoint List,Email Column = varUserEmail,Status="IN" )) > 0, 
 Patch(
      Sharepoint List,
       First( Filter(Sharepoint List, Email Column Name = varUserEmail , Status="IN")),
       {
         Check_x0020_Out: Now(),
         Status: "OUT"
       }
     )
   
  
);

Navigate(MainScreen;ScreenTransition.Fade)

 


Check Out > Display Code

 

If(!IsBlank(LookUp(SharePoint List, Email Column Name =varUserEmail And Status="IN" )),DisplayMode.Edit,DisplayMode.Disabled)

 

 

Note: Change the SP List name to your list name, Change The Email Column Name to Your Email Column Name and I use ( ; ) for Code end and Single ( , ) for next column to patch. 
Edit the Code accordingly.

 

Let me Know if I helped you :).

 

 

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: Powerapp does not update sharepoint list after app closing

Hi @Bartek1 ,

 

Glad to hear that it worked for you!!!

 

Don't worry it's just the delegation warning not an error you will still use the application good.

 

and do me favor can you please mark my reply as a Solution. So, that everyone could find it.

 

if you need any help feel free to contact 🙂

Thanks

View solution in original post

19 REPLIES 19
Highlighted
Resolver I
Resolver I

Re: Powerapp does not update sharepoint list after app closing

Hi, 

 

Use below one as you have used the (;) instead of (,) in function. 

 

OnSelect: Refresh('Sharepoint List'); If(!IsBlank(CurrentCheckedInRecord),Patch('Sharepoint List',CurrentCheckedInRecord,{CheckOut:Now()})), Navigate(MainScreen,ScreenTransition.Fade)

 

DisplayMode: If(
    !IsBlank(LookUp('Sharepoint List', StaffEmail=varUserEmail And CheckOut=Blank())),
    DisplayMode.Edit,
    DisplayMode.Disabled)

 

I hope it will work. 

 

 

Highlighted
Helper II
Helper II

Re: Powerapp does not update sharepoint list after app closing

@VDS_Mantrait didnt work, i need to use (;) as i use powerapp in other language than English. There is no error in the app and the checkout button works but only when it is clicked during the same period the checkin button was clicked. If i click checkin button and then close the app, when I open the app again, i can click checkout button but it does not upload my data on sharepoint. 

 

I do not understand why it works directly after using checkin button but do not work after the up is reopen.

Highlighted
Helper II
Helper II

Re: Powerapp does not update sharepoint list after app closing

@MH3here is the issue:

Basically I have the app that has the check in and check out function and additional screen that display the gallery of the records.

The check in and check out button works but after I close the app and open again, check out button does not work and do not update the data on my sharepoint.

 

Many thanks in advance!

Highlighted
Post Prodigy
Post Prodigy

Re: Powerapp does not update sharepoint list after app closing

Hi @Bartek1 ,

 

are you saving User Email? in your SP list?

and can I see your Check In and Check Out Button OnSelect and Display Mode Codes? 

Highlighted
Helper II
Helper II

Re: Powerapp does not update sharepoint list after app closing

@MH3 

Check in button:

On Select: Set(CurrentCheckedInRecord; Patch('Sharepoint List'; Defaults('Sharepoint List');{Title:"Employee";StaffFullName:User().FullName;StaffEmail:User().Email;CheckIn:Now()}));; Navigate(MainScreen;ScreenTransition.Fade)

Display Mode: If(IsBlank(LookUp('Sharepoin List'; StaffEmail=varUserEmail And CheckOut=Blank()));
    DisplayMode.Edit;
    DisplayMode.Disabled)
 

 

CheckOut:

OnSelect: Refresh('Sharepoint List');; If(!IsBlank(CurrentCheckedInRecord); Patch('Sharepoint List';CurrentCheckedInRecord;{CheckOut:Now()}));; Navigate(MainScreen;ScreenTransition.Fade)

DisplayMode: If(
    !IsBlank(LookUp('Sharepoint List'; StaffEmail=varUserEmail And CheckOut=Blank()));
    DisplayMode.Edit;
    DisplayMode.Disabled)

 

I also have in this screen onVisible: Set(varUserEmail;User().Email)

 

 

Highlighted
Resolver I
Resolver I

Re: Powerapp does not update sharepoint list after app closing

Hi, 

 

It doesn't update because after closing the app, it didn't found any reference ID for updating the Checkout data. You need to set a UID/Ticket ID for each record and whenever user open the app again then he need to select the Ticket ID/UID from list and basis on that ID lookup you need to pass the ID reference in Power Flow to get updated the same record. 

 

Hope you understand what i am trying to explain. 

Highlighted
Helper II
Helper II

Re: Powerapp does not update sharepoint list after app closing

@VDS_Mantra  the user is recognized by the email address. Isn't it the problem with the Set function? Maybe it should be something else?

Highlighted
Resolver I
Resolver I

Re: Powerapp does not update sharepoint list after app closing

Hi, 

 

As you use the below function on Check out button, so after closing the app set variable value of "CurrentCheckedInRecord" will be null, so this is the reason it works properly when you do both activity during open the app, however as you close the app this variable value will be null and checkout button patch did not found any reference for updating the record of same user. 

 

Here, you need to set some UID/Ticket No. to resolve this problem. 

 

Hope you got my point. 

 

CheckOut:

OnSelect: Refresh('Sharepoint List');; If(!IsBlank(CurrentCheckedInRecord); Patch('Sharepoint List';CurrentCheckedInRecord;{CheckOut:Now()}));; Navigate(MainScreen;ScreenTransition.Fade)

Highlighted
Post Prodigy
Post Prodigy

Re: Powerapp does not update sharepoint list after app closing

Hi @Bartek1 ,

 

There are some changes, in your display and OnSelect Codes.

 

First of All, what I did I am storing a status in SP List, like if someone checks in, then it will Store "IN"  in the Status Column, and when the user checks out it will patch the column with Out, which means the user checked out that day.

This will help you to configure your display code and OnSelect code according to that.

So,
Steps:

1)  Create a column in your SP List, Status and set the column as Single Line Text.
2) you have to update your Check in Code, Like this

Check IN > OnSelect

 

Patch('Sharepoint List'; Defaults('Sharepoint List');{
Title:"Employee",
StaffFullName:User().FullName,
StaffEmail:User().Email,
Check_x0020_In:Now(),
Status: "IN"
}
);
 Navigate(MainScreen;ScreenTransition.Fade)

 

Check IN > Display Mode:

 

If(!IsBlank(LookUp(Sharepoint List,Email Column Name =varUserEmail And Status="IN" )),DisplayMode.Disabled,DisplayMode.Edit)

 


CheckOUT > OnSelect

 

Refresh('Sharepoint List');

If(
 CountRows(Filter( Sharepoint List,Email Column = varUserEmail,Status="IN" )) > 0, 
 Patch(
      Sharepoint List,
       First( Filter(Sharepoint List, Email Column Name = varUserEmail , Status="IN")),
       {
         Check_x0020_Out: Now(),
         Status: "OUT"
       }
     )
   
  
);

Navigate(MainScreen;ScreenTransition.Fade)

 


Check Out > Display Code

 

If(!IsBlank(LookUp(SharePoint List, Email Column Name =varUserEmail And Status="IN" )),DisplayMode.Edit,DisplayMode.Disabled)

 

 

Note: Change the SP List name to your list name, Change The Email Column Name to Your Email Column Name and I use ( ; ) for Code end and Single ( , ) for next column to patch. 
Edit the Code accordingly.

 

Let me Know if I helped you :).

 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published 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 (5,645)