cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Responsive Resident
Responsive Resident

Unable to Submit Form

Hello Everyone,

 

I am building an app based on a SharePoint List. I have created a screen where i have added two forms, one is View (where only columns which would be read only to the users) and Edit (10 columns where users will have to add entries).

I have to change the status of the item which will be created in to the list hence i used patch function. In addition to that i also want the user inputs to be appended in to the list item hence i am using SubmitForm() function. But except submit form action all the other things are working fine. I am not sure where i am doing mistake. Can anyone please help me understand where i am going wrong? Below the code:

 

If(InputForm.Valid,
Set(
    VarItem,
    If(
        DataCardValue73.Selected.Value = "Complex",
        Patch(
            'List Name',
            VarItem,
            {
                Status: {Value: "Under VSM Review"}
            }
        ),
        Patch(
            'List Name',
            VarItem,
            {
                Status: {Value: "In Development"}
            }
        )
    )
);
If(
    DataCardValue73.Selected.Value = "Complex",
    Office365Outlook.SendEmailV2(),
    Office365Outlook.SendEmailV2());
    Office365Outlook.SendEmailV2(); SubmitForm(InputForm); Navigate(Screen_Intake_List),
Notify("Comments are mandatory hence please enter the details in form and then click on the 'Approve' button.",Error))

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @AkshayManke ,

You are setting varItem to the returned Patch and then also using it as the record reference. If you have the ID of the record you want to Patch to, this will work

If(InputForm.Valid,
   With(
      { 
         wValue:
         If(
            DataCardValue73.Selected.Value = "Complex",
            "Under VSM Review",
            "In Development"
         )
      },
      Patch(
         'List Name',
         {ID:YourIDNo},
         {Status: {Value: wValue)}
      )
   )
);
If(
   DataCardValue73.Selected.Value = "Complex",
   Office365Outlook.SendEmailV2(),
   Office365Outlook.SendEmailV2());
   Office365Outlook.SendEmailV2(); 
   SubmitForm(InputForm); 
   Navigate(Screen_Intake_List),
   Notify("Comments are mandatory hence please enter the details in form and then click on the 'Approve' button.",Error)
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @AkshayManke ,

You are setting varItem to the returned Patch and then also using it as the record reference. If you have the ID of the record you want to Patch to, this will work

If(InputForm.Valid,
   With(
      { 
         wValue:
         If(
            DataCardValue73.Selected.Value = "Complex",
            "Under VSM Review",
            "In Development"
         )
      },
      Patch(
         'List Name',
         {ID:YourIDNo},
         {Status: {Value: wValue)}
      )
   )
);
If(
   DataCardValue73.Selected.Value = "Complex",
   Office365Outlook.SendEmailV2(),
   Office365Outlook.SendEmailV2());
   Office365Outlook.SendEmailV2(); 
   SubmitForm(InputForm); 
   Navigate(Screen_Intake_List),
   Notify("Comments are mandatory hence please enter the details in form and then click on the 'Approve' button.",Error)
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Hello @WarrenBelz,

 

Many Thanks for the help. I tried to add the SubmitForm() in the top (before the patch function) and it worked as expected, below the code.

If(InputForm.Valid,
SubmitForm(InputForm);
Set(
    VarItem,
    If(
        DataCardValue73.Selected.Value = "Complex",
        Patch(
            'List Name',
            VarItem,
            {
                Status: {Value: "Under VSM Review"}
            }
        ),
        Patch(
            'List Name',
            VarItem,
            {
                Status: {Value: "In Development"}
            }
        )
    )
);
If(
    DataCardValue73.Selected.Value = "Complex",
    Office365Outlook.SendEmailV2(),
    Office365Outlook.SendEmailV2());
    Office365Outlook.SendEmailV2(); Navigate(Screen_Intake_List),
Notify("Comments are mandatory hence please enter the details in form and then click on the 'Approve' button.",Error))

However i am trying your solution as well where you have suggested to use With function. I am accepting it as solution. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (25,026)