I have a 3 screen app and have setup deep linking to the "third screen" based on a URL parameter. Pretty reliably (near 100% of the time) if a user utilizes the deeplink for their "first access" to the app, the OnVisible attribute for the third screen reads the global variable set by App OnStart as blank. However, I've added a debug text box to the screen and it 'clearly' shows the Global Variable value I expect. If I add a button to the screen that basically re-runs the code in OnVisibile everything functions as I expect.
The app is backed by a Sharepoint List if this matters.
The code that I think matters is:
App: OnStart:
...
If (Param("TargetScreen") = "Edit",
Set(SelectedItemID, Value(Param("NCRID")))
)
App: StartScreen
If (Param("TargetScreen") = "Edit",
NCREntryScreen,
Browse_All )
NCREntryScreen: Onvisible
If(IsBlank(SelectedItemID),
// We are creating a new NCR
UpdateContext({CurrentNCRID: ""}),
// We are working with an existing NCR
UpdateContext({CurrentNCRID:
LookUp([@NCRs],
ID = SelectedItemID,
Title
)
}
)
)
My Diagonistic Text Label: Text value is:
Concatenate("SelectedItemID: ", SelectedItemID, " NCRID: ", CurrentNCRID)
Re-try button: OnSelect
If(IsBlank(SelectedItemID),
UpdateContext({CurrentNCRID:First(AdHocNCRID).Title}),
UpdateContext({CurrentNCRID:
LookUp([@NCRs],
ID = SelectedItemID,
Title
)
}
)
)
If I access the app with a url like the one below:
https://apps.powerapps.com/play/<APPID>?NCRID=542&TargetScreen=Edit
I am correctly routed to the desired screen, but the Text Label value shows: "SelectedItemID: 542 NCRID: "
Usually if I go to re-paste the URL in the browser it will render correctly like this: "SelectedItemID: 542 NCRID: 10396", right at the moment as I'm posting this, it's not behaving like this, but I'm not sure if my testing broke a piece of the code.
Is this because OnVisible is running before something's getting fully set? Would appreciate any insight.