web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SharePoint Custom Form...
Power Apps
Unanswered

SharePoint Custom Form - Two View Screen Options Based on List Column

(0) ShareShare
ReportReport
Posted on by 10

Hello all,

 

I'm trying to make a custom form for my SharePoint list, which for planning/use purposes has two different types of items, "Internal Events" and "Pre-Arrival Initiatives". They are both primarily viewed via Calendar views in SharePoint, and each have very different column choices. Thus I was looking to make each have it's own "View" form screen. "Edit" and "New" will likely only be done by me, so I just have all columns on the same screen for these. To have something to point the code at for differentiating the two types, I have a choice column named FormType with two choices, the exact names of each used above.

 

Using this article, I established separate screens for View, New, and Edit. I duplicated the Screen and Form for View, and renamed it. Then for the OnView action, I used this code:

 

Set(SharePointFormMode, "ShowForm");
If(SharePointIntegration.Selected.FormType.Value = "Internal Events", ViewForm(SharePointForm1),SharePointIntegration.Selected.FormType.Value = "Pre-Arrival Initiatives", ViewForm(SharePointForm2));
If(SharePointIntegration.Selected.FormType.Value = "Internal Events", Navigate(FormScreen1, ScreenTransition.None),SharePointIntegration.Selected.FormType.Value = "Pre-Arrival Initiatives", Navigate(FormScreen2))

 

 

This sort-of works, with 90% of the time displaying the form type that you last viewed, only correcting when you leave and come back again. For example, clicking an Internal Event shows the Internal Event View form, then exiting and clicking a Pre-Arrival Initiative shows it with an Internal Event View form, corrected when you exit the item and enter back into it. I'm at a loss at this point, unfortunately all I know on PowerApps is self taught from forums (I work in Hospitality, ha).

 

Any thoughts on what might be wrong with the code, or an alternate way to recognize the item's value in the FormType column? Should I place this same code elsewhere? Can I put a sort-of "Loaded incorrectly? Click here!" refresh button on the bottom of the form at least? Any thoughts or ideas are greatly, greatly appreciated!!

Categories:
  • HamidBee Profile Picture
    932 Super User 2024 Season 1 on at

    Try this:

    Set(SharePointFormMode, "ShowForm");
    Switch(SharePointIntegration.Selected.FormType.Value, 
     "Internal Events", Navigate(FormScreen1, ScreenTransition.None), 
     "Pre-Arrival Initiatives", Navigate(FormScreen2),
     /* add additional cases here */
     /* if no match is found, use the default case */
     Navigate(FormScreen1, ScreenTransition.None)
    );
    
    ViewForm(Switch(SharePointIntegration.Selected.FormType.Value, 
     "Internal Events", SharePointForm1, 
     "Pre-Arrival Initiatives", SharePointForm2,
     /* add additional cases here */
     /* if no match is found, use the default case */
     SharePointForm1
    ))

     

     

    If my reply helped you, please give a 👍, & if it solved your issue, please 👍& Accept it as the Solution to help other community members find it more.

  • DillonHcon Profile Picture
    10 on at

    Thank you for your reply!

     

    Unfortunately the issue is still happening. I've tried waiting short and long intervals between my switching, and different browsers in case it is somehow cache/cookie related, but it still happens all the same.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard