I've followed your steps but added additional functionality.
I have three screens:
- MainScreen
- Screen1
- Screen2
Main screen has a form that includes the dropdown control. In the dropdown, in the OnSelect, I've added the following:
If(DataCardValue_MyDD.Selected.Value="Type A", Navigate(Screen1), DataCardValue_MyDD.Selected.Value="Type B", Navigate(Screen2))
This works, however, if navigated to Screen1, the form includes data from previous entries. This is the same behavior when navigated to Screen2. Also, if I click the New button in the SharePoint list, it doesn't load the MainScreen but instead the Screen1 or Screen2. If I refresh SharePoint, and click New, it loads the MainScreen.
To fix both issues, I've tried the following formula on SharePointIntegration in PowerApps. I've added this code to the OnNew event.
NewForm(MainForm); Set(varFormMode,FormMode.New); Navigate(MainScreen,ScreenTransition.None); ResetForm(MainForm); ResetForm(Form1); ResetForm(Form2);
This doesn't fix the issues. Is there a way to resolve both issues? Also, do I need to add any scripts to the OnEdit or OnView events to ensure that the item that's selected in SharePoint, loads the correct form? So, on the MainScreen, I select dropdown value, "Type A", it navigates to Screen1. I fill out Form1 and Save. When I click the saved item, I expect to see fields listed in Screen1 and not Screen2.
EDIT:
The ResetForm function works as long as Form1 and Form2, Default Mode is set to New. By default, it's set to Edit. I assume the ResetForm function doesn't work well if the form's default mode is Edit or View.
NewForm(MainForm); Set(varFormMode,FormMode.New); Navigate(MainScreen,ScreenTransition.None); ResetForm(MainForm); ResetForm(Form1); ResetForm(Form2);
The issue that I'm having now has to do with the OnEdit and OnView events. Both are set like this: ViewForm(MainForm). So, when I select a saved entry, it displays the main screen and not the screen based on which drop down item I've selected.