cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GDSI
Frequent Visitor

Open screen and populate form using an ID, not selectedItem

Need to open a screen, and populate a single-record form, using the form.LastSubmit.ID

 

Currently, I open the screen and populate the form from a search screen (scrSearch) that has a gallery. In the gallery is a Next button, which uses OnSelect of:

   Navigate(scrObservationDetails, ScreenTransition.Fade,{selectedItem: galResults.Selected})

 

FACTS:

1. The data is a 1-M of Observations and ObservationItems, stored in SharePoint.

2. From scrSearch, the user can create a new Observation on scrObservationNew.

3. When a new observation is saved, a Flow is triggered to populate some ObservationItems, based on another template list.

 

Currently, after a new Observation is created, the user is Navigated back to the search screen (scrSearch), and then must search for the new record, then click on the Next button in the results gallery. (galResults). Need to cut out the middleman, and navigate the user straight from the new form to the detail form.  

 

QUESTION: What is the proper Context to add to the navigate function to open a screen, and populate a single-record form, in the same way that selectedItem would?

 

scrObservationNew.frmObservation.OnSuccess: 


    Navigate(scrObservationDetails, ScreenTransition.Fade, { [?what goes here?] : frmObservation.LastSubmit.ID })

 

TIA

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@GDSI 

Consider a basic global variable for this.

 

Change your Gallery Next Button OnSelect to the following:

Set(glbCurrentRecord, ThisItem);
Navigate(scrObservationDetails, ScreenTransition.Fade)

Set the Items property of all of your Forms to glbCurrentRecord

 

In the OnSuccess of the Form, set the formula to the following:

Set(glbCurrentRecord, Self.LastSubmit);
Navigate(scrObservationDetails, ScreenTransition.Fade)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@GDSI 

Consider a basic global variable for this.

 

Change your Gallery Next Button OnSelect to the following:

Set(glbCurrentRecord, ThisItem);
Navigate(scrObservationDetails, ScreenTransition.Fade)

Set the Items property of all of your Forms to glbCurrentRecord

 

In the OnSuccess of the Form, set the formula to the following:

Set(glbCurrentRecord, Self.LastSubmit);
Navigate(scrObservationDetails, ScreenTransition.Fade)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

GDSI
Frequent Visitor

The gallery is on the Search screen. I want to go from the New screen, which doesn't have a gallery (only a form), to the Details screen. Will this technique still work?

RandyHayes
Super User
Super User

@GDSI 

Yes, this will still work just fine.  As long as you have the Item property on the other forms set to glbCurrentRecord - you will be dealing with either the selected record from the Gallery, or from the last submitted record from the New Form.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GDSI
Frequent Visitor

Ok.. I use a global var for the items, so am familiar with the technique. So, that LastSubmit is the key to many locks. Thanks!

 

Summary Answer:  Use a global var, which make a record object, using the LastSubmit construct.

 

ex. Set(glbCurrentRecord, Self.LastSubmit);

RandyHayes
Super User
Super User

@GDSI 

Yes, a variable can be anything.  In this case we're just capturing the LastSubmit of the form in it and using it everywhere else needed.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,813)