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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (1,981)