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 / PowerApp Sharepoint Se...
Power Apps
Unanswered

PowerApp Sharepoint Set Variable not loading first time

(0) ShareShare
ReportReport
Posted on by 2

Hi all,

I am creating Power App form with SharePoint. I am trying to Set a variable while form loads. I tried to set variable in OnNew, OnEdit and OnView. When I open the form twice, I can load variable with the SharePoint value. However, It is not loading first time. The formula I am using is

Set(varComments,SharePointIntegration.Selected.Comment);

 

I don't know why it is not loading first time. Please help me out.

 

Thanks,

Categories:
  • TiagoFreire Profile Picture
    313 on at

    More information would be useful. is this a form customizing a sharepoint list, or a standalone canvas app? 

    The Form might be running its events before SharePointIntegration data loads, so Selected is blank.  

    That could explain why it only works on the second load onwards.

    Use the Gallery's OnSelect to control the Form's state and have the user select an item to edit.

     

    If the explanation does not seem to fit your app, please explain in more detail. 

  • NavasShereef Profile Picture
    2 on at

    Hi Tiago,

    Thanks for the reply. I  am customising only Edit, New and display form of SharePoint list form and not using gallery because i am ok with default allitem.aspx page. When I click new or edit from allitem page, setting a variable fails. and when I try again it sets the variable. 

  • TiagoFreire Profile Picture
    313 on at

    Ahh, memories. 

     

    SharePointIntegration.Selected is Blank or Empty the first time it loads. 

    So all the action will find no data. 

     

    It's not a bug, it is an "opportunity for improvement". I have been through PowerApps Support with this. 

     

    You can either have a "reload" button in your Form (which is awkward, since you loaded it from a selected item already), to manually re-check for the data. 

    Or have a timer with a short loop continuously check the SharePointIntegration.Selected property until it loads. Then populate your vars and stop the Timer. 

  • amitabha169516 Profile Picture
    4 on at

    Hi Tiago,

    Could you please explain how to use timer in this case? Please explain with example.

  • TomSlosse_ Profile Picture
    9 on at

    Hey @TiagoFreire 

     

    I know it's been a while, but  could you elaborate on your workaround for this issue?

    Thanks in advance.

     

    Kind regards

     

    Tom

  • TomSlosse_ Profile Picture
    9 on at

    Hey @amitabha169516 

     

    I know it's fairly late to reply and maybe you found the solution but I just wanted to give my experience with it.

    I fixed this by selecting the SelectedListItemID, apparently there is no delay on that.

    So in the OnStart or OnView, OnEdit or Onvisible you can do something like this:

    Set(varComments, Text(LookUp(<yourDatasource>, ID = SharePointIntegration.SelectedListItemID).Comment));

    That did the trick for me.

     

    Kind regards

     

    Tom

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard