0

I am customizing SharePoint library form in Power app.

OnSave

event there is:

SubmitForm(SharePointForm1)

However I want to save some custom values by applying formulas based on user selection and save to SharePoint fields without user knowing via form. How can i achieve it ?

I have tried

    SubmitForm(SharePointForm1);
  Patch(
       Test_DocumentLibrary,
      Defaults(Test_DocumentLibrary),
       {
                   
                    TestCol :"Ac"
             
        }
        );

but the above returns the error

network error when using patch function: the requested operation is invalid.

I have also tried by removing the line

SubmitForm(SharePointForm1);

1
  • Are you trying to add values to custom columns in same library? If yes, you can add those fields to your form, set visible = false to hide those from users. Set their Default and Update property to your calculated formula and it will be saved automatically when user saves the form. Commented Oct 28, 2022 at 4:56

1 Answer 1

1

If you are trying to add values to custom columns in same library, follow below steps for all custom columns:

  1. Add the fields to your form by selecting form control and then fields from property pane at right hand side

  2. Set Visible property of data card to false to hide those fields from users.

  3. Set their Default and Update property to your calculated formula as per your requirements

  4. Those fields will be saved/updated automatically when user saves the form using SubmitForm(SharePointForm1).

4
  • OR you can use Patch function after SubmitForm like: Patch(SPLibrary, SharePointForm1.LastSubmit, {HiddenColumn: TextInput.Text}) Commented Oct 28, 2022 at 5:03
  • I was trying by this approach but I am getting error. I have edited my question above with sample code that I tried
    – Saira
    Commented Oct 28, 2022 at 6:08
  • 1
    It's better to try the approach given in my answer. Also, while using Patch if you use Defaults(Test_DocumentLibrary), it tries to create a new item. So, it will not work. You have to use SharePointForm1.LastSubmit as 2nd parameter to Patch. Commented Oct 28, 2022 at 6:40
  • 1
    Thank you Ganesh. Yes the above answer will meet my requirements and also your comment above regarding Patch is also helpful to me.
    – Saira
    Commented Oct 28, 2022 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.