cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Continued Contributor
Continued Contributor

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
Super User

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
Super User

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.

 

AkshayManke
Continued Contributor
Continued Contributor

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
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.

Users online (4,820)