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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / App OnStart not workin...
Power Apps
Unanswered

App OnStart not working when publishing the form

(0) ShareShare
ReportReport
Posted on by 71

Hi,

 

I am setting data in the App OnStart function. It works when I hit the Run OnStart button to test it. But when I publish the form, it doesn't seem work. 

 

Similar to this post: OnStart or OnVisible only running once when opened from a sharepoint list 

 

The code is simple, I am just trying to get an ID from a different list by another ID that is in both lists. I have tried a few different ways, like:

 

// Set(varEmploymentServiceID,Filter('The other List',Value(lblID.Text) = theField.Value).ID);
ClearCollect(colESData,Filter('The other List',lblID.Text = theField.Value).ID)
// If(!IsBlank(varEmploymentServiceID),Set(varESId, First(varEmploymentServiceID).ID),Set(varESId,0))

 

Both of these work when Run OnStart and then look at the variables. But it doesn't work when published and I try to do a Notify() to show me the ID.

 

Any Ideas??

 

Thanks,

 

Monty

 

 

Categories:
I have the same question (2)
  • LaurensM Profile Picture
    12,516 Moderator on at

    @NiteWalker 

     

    Hi Monty,

     

    OnStart works a bit different in Customized Forms - it runs the first time you open the form until you e.g. refresh the browser tab. The easiest way to achieve a similar functionality is by using the Screen's OnVisible property.

     

    In a standalone Canvas App, the OnStart would run each time the application is opened/refreshed.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    The problem is that there is no guarantee that the connections to the data sources have completed loading by the time your OnStart code runs.  They will be when you run it from the designer, but when you run it from the app itself they may still be loading. I would try moving this code to the OnVisible property of your start page. That may help with the timing.

  • NiteWalker Profile Picture
    71 on at

    Hi,

     

    Thanks for the quick replies!

    I have moved the same code into the OnVisible property and it still doesn't seem to be working. I have verified that there is a item in the other table that should be returned. I tried showing the returned value in both a Notify and setting a label's text to the returned value.. both always blank!

     

    Also - does the OnVisible run every time a form is closed and then a different list item is open? It doesn't look like it from what I see, was just wondering what you all see.

     

    -Monty

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @NiteWalker,

     

    After some testing, the OnVisible indeed only seems to run once. Given that information I would recommend writing your code in the OnView property of the SharePointIntegration component.

     

    If you need to reference the ID of the selected record in this property, you can use 'Self.SelectedListItemID'. I will change lblID.Text to this reference instead:

    ClearCollect(
     colESData,
     Filter(
     'The other List', 
     Text(Self.SelectedListItemID) = theField.Value
     ).ID
    )

     

    I hope this helps!

  • NiteWalker Profile Picture
    71 on at

    Wow - that was way more painful that it should have been.

     

    Using the OnView property helped a lot!! Have to remember this one.

     

    Thanks,

     

    Monty

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard