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 / Display fields on NewF...
Power Apps
Answered

Display fields on NewForm based on content type

(3) ShareShare
ReportReport
Posted on by 46
Hello,
 
I have a SharePoint list which contains two content types: ContentTypeA and ContentTypeB.
 
ContentTypeA has two fields: Title and Type
 
ContentTypeB has one field: Title
 
In OOTB SharePoint, when a new item is added, in the EditForm and DisplayForm, the content type field displays.  I want to hide the content type field.  As a result, I've used a custom form created in PowerApps to hide the content type field.
 
On new item, if I click ContentTypeA, I should see two fields. If I click ContentTypeB, I should see one field. However, when I click ContentTypeB, it displays the fields of ContentTypeA because ContentTypeA is the default content type.
 
In PowerApps, for the Type field and in the Visible property, I've added the following formula: If(ThisItem.'Content type'.Name="ContentTypeA ",true,false).  The results of this formula is on NewForm, the Type field does not display when clicking ContentTypeA or ContentTypeB. 
 
I need the PowerApps form to behave similarly to OOTB SharePoint. In that, when I click ContentTypeA, I see the intended fields. Same if I click ContentTypeB.
 
Is this possible in PowerApps?
 
BTW, I do not have this issue when using this formula when on the EditForm or DisplayForm.  Based on the content type, the correct fields display on these forms.
 
 
Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    hey
     
     
    where do you choose if it is content type a or b?
     
    thanks in advance,
     
     
    cheers
  • Verified answer
    EW-20120954-0 Profile Picture
    42 on at
    Hi! it is definitly possible to achieve, I have summarized it below.

    If this worked for you please accept this answer as a accepted solution!
     

    In PowerApps, you can dynamically show or hide fields based on the selection of "Type A" or "Type B" using the Visible property of controls. Here's how to do it:

    Steps:

    1. Add a Dropdown for Selection:

      • Insert a Dropdown control (ddTypeSelection).
      • Set its Items property to:  ["Type A", "Type B"]
    2. Add Input Fields:

      • Add text input controls or other controls needed for both Type A and Type B.
      • Example:
        • txtFieldForA → Field specific to Type A
        • txtFieldForB → Field specific to Type B
    3. Set Visibility Based on Selection:

      • For fields related to Type A (txtFieldForA), set the Visible property to:
         
        ddTypeSelection.Selected.Value = "Type A"
        		
        
        		
        		
      • For fields related to Type B (txtFieldForB), set the Visible property to:
         
         
        ddTypeSelection.Selected.Value = "Type B"

    Optional Enhancements:

    • If you have multiple fields for each type, group them inside Containers to simplify visibility control.
    • Use Switch() instead of multiple If conditions for better maintainability.
  • itchel123 Profile Picture
    46 on at
     
    I've followed your steps but added additional functionality. 
     
    I have three screens:
    1. MainScreen
    2. Screen1
    3. 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. 

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard