web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SharePointIntegration ...
Power Apps
Unanswered

SharePointIntegration Selected record in OnNew refers to last selected item

(0) ShareShare
ReportReport
Posted on by 2

When using a PowerApp form for SharePoint I recently removed the ResetForm() and RequestHide() command on the OnSuccess event in my SharePointFrom1 control. The idea was for a particularly large form the user could hit Save mid way through the data entry, the records would be created in the list and the form would remain on the screen for them to continue. 

 

What I experienced was that the record was created in the list, but the form switched to viewing the last viewed item (or the first item in the list if none had previously been viewed). This appears to be because when a new item is being created the SharePointIntegration.Selected and SharePointIntegration.SelectedListItemId refer to the last viewed item when submitting the form when in New mode. Shouldn't these two properties in the first instance be blank, and preferably then refer to the item that was just submitted? Having it refer to an arbitrary item in the list is surely not correct? If I hadn't spotted this I'd have had people cxreating a new item, then overwriting a different item with subsequent saves.

Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @BoredRoss ,

    Do you want to remain the submitted item wthin the Edit form (SharePointForm1) without reseting?

     

    Based on the needs that you mentioned, I think a global variable could achieve your needs. Please consider take a try with the following workaround:

    Set the OnSuccess property of the SharePointForm1 (Edit form) to following:

    Set(SubmittedRecord, SharePointForm1.LastSubmit)

    Set the Item property of the SharePointForm1 (Edit form) to following:

    If(
     !IsBlank(SubmittedRecord),
     SubmittedRecord,
     If(
     IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),
     'Your SP List'
     SharePointIntegration.Selected
     )
    )

    Set the OnNew property of the SharePointIntegration control to following:

    Refresh('Your SP List');
    Set(SubmittedRecord, Blank());
    NewForm(SharePointForm1)

    Set the OnEdit property of the SharePointIntegration control to following:

    Refresh('Your SP List');
    Set(SubmittedRecord, Blank());
    EditForm(SharePointForm1)

    Set the OnView property of the SharePointIntegration control to following:

    Refresh('Your SP List');
    Set(SubmittedRecord, Blank());
    ViewForm(SharePointForm1)

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • BoredRoss Profile Picture
    2 on at

    Hi Kris, thanks for looking at this. I'll try your solution on a test list and feed back to you. I've taken a similar (but slightly different) approach also using a global variable and got the outcome I desired, but a couple of the details in your solution look neater so I'll try and combine them.

     

    Regards,

    Ross

  • cbernier35 Profile Picture
    50 on at

    Does this work? The following doesn't seem to take in the form, just throws a bunch of errors:

     

    If( !IsBlank(SubmittedRecord), SubmittedRecord, If( IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected), 'Your SP List' SharePointIntegration.Selected ) )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard