Overview
In this article, we will learn how we can create a common Display Form or Edit Form for different Gallery Sources within the PowerApps.
Scenario
We have two screens.
- Gallery having information about the interviewers whose designation is “BI Developer”.
- Gallery having information about all the Interviewers.
Both the screens have a “View More” button. When the user clicks on the View More, a Common Details form should be opened.
We need a common form, no matter which screen the user has selected the record from.
So, now let’s get started!
Step 1
We have the following two screens.
Gallery with data having the designation = “BI Developer”.
Step 2
Add a button to “View More” in both the screens.
Step 3
Add the following line of the code in Screen1’s Gallery.
Here, we have added a Context Variable named “SelectedItem” with the Navigate function. The “SelectedItem” variable store the record which has been selected from the gallery.
- Navigate(
- DetailForm,
- ScreenTransition.Cover,
- {SelectedItem: Gallery1.Selected}
- );
Step 4
Add the following line of code in Screen2’s Gallery.
Here, we will use the same context variable named “SelectedItem” which stores Gallery2’s selected item.
- Navigate(
- DetailForm,
- ScreenTransition.Cover,
- {SelectedItem: Gallery2.Selected}
- );
Step 5
We already have a details form.
In the details form, we need to set the item value.
So, add the following line of code in Detail Form’s item action.
Step 6
Now, let’s run the application and select one record from the Galley 1.
Below is the output.
Now, let’s run the application and select one record from the Galley 2.
Below is the output.
Conclusion
This is how we can easily create a common detail form or Edit Form for different galleries.
I hope you love this article. Stay connected with me for more amazing Power Platform articles like Power BI, PowerApps and MS Flow.
Happy PowerApping!