cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lars1990
Helper II
Helper II

Store form names in a collection to submit form dynamically

Hi all,

 

I saw a post about being able to dynamically navigate to a screen

 

ClearCollect(screenIndex,
    { Name: "ScreenA", Screen: ScreenA },
    { Name: "ScreenB", Screen: ScreenB },
    { Name: "ScreenC", Screen: ScreenC },
    { Name: "ScreenD", Screen: ScreenD },
    { Name: "ScreenE", Screen: ScreenE })
Navigate(
    LookUp(screenIndex, Name = ThisItem.Screen).Screen,
    ScreenTransition.Fade)

 

I would like to do something similar with submiting a form like the example below. Unfortunatly it gives an error in the collection. Anyone with ideas how to do this?

 

ClearCollect(formIndex,
    { Name: "FormA", Form: FormA},
    { Name: "FormB", Form: FormB },
    { Name: "FormC", Form: FormC },
    { Name: "FormD", Form: FormD },
    { Name: "FormE", Form: FormE })

 

SubmitForm(
    LookUp(formIndex, Name = varForm).Form)
1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Lars1990 

The problem is that your forms have different schemas to them, so you will not be able to store more than one form in your table.  In other words, it's not the submit form that has the issue, it is the schemas of the forms in your Form column of your table.

 

Please consider changing your Formula to the following:

SubmitForm(
    Switch(varForm,
        "FormA", FormA,
        "FormB", FormB,
        "FormC", FormC,
        "FormD", FormD,
        "FormE", FormE
    )
)

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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

2 REPLIES 2
RandyHayes
Super User
Super User

@Lars1990 

The problem is that your forms have different schemas to them, so you will not be able to store more than one form in your table.  In other words, it's not the submit form that has the issue, it is the schemas of the forms in your Form column of your table.

 

Please consider changing your Formula to the following:

SubmitForm(
    Switch(varForm,
        "FormA", FormA,
        "FormB", FormB,
        "FormC", FormC,
        "FormD", FormD,
        "FormE", FormE
    )
)

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Perfect! Thanks 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,292)