cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cvazquc3
Helper I
Helper I

Attachments saving with code Patch not work

Hello everyone

Good morning

I have a question.

I have a form as FormNew, but I need integrate the control Attachment, I add in my form and I required SAVE record with the function Patch, NOT Form.Updates.

I attached an image.

 

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@cvazquc3 

So if you are using an Form, then all of the work is done for you.

Typically, instead of popping up lots of Notify messages, the preferred method is to simply set the datacards you are checking for Blank to be required (Required - true).  The form will then notify the user directly in the form.

 

As for your Formula:

1) Again, all of the If statements can go away if you just set those datacards to Required.

2) SubmitForm is pretty much the only thing you need in your submit button.  Except in your case you will want to wrap that to test the connection:

If(Connection.Connected && NewForm_1.Valid,
    SubmitForm(NewForm_1),

    Notify("La conexión de internet ha fallado, revise su conexión", Warning, 5000)
)

3) You do not need to do a Refresh statement on the datasource...it will already be updated.

4) The OnSuccess action of NewForm_1 should be set to:

Notify("Elemento guardado", Success, 4000);
ResetForm(NewForm_1)
Navigate(BrowseScreen1, Cover);

 

_____________________________________________________________________________________
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

5 REPLIES 5
RandyHayes
Super User
Super User

@cvazquc3 

Why are you not using SubmitForm on the form?  All of the things you are doing in the massive If tree can be handled directly in the form.  The only thing you need is SubmitForm.

 

AND...I say that because you CANNOT patch attachments.  The only solution for submitting attachments is using the SubmitForm.

 

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!

Hello Randy

Thank you for your support

Before to accept as solution, could you please comment you 2 question.

1.- If I omite function Path, not problem with save new registers?

2.- Could you please comment, if my code is good?, attached an image. And if you can view an error or improve in this code, could you please confirm me?
Thank you 

 

 

RandyHayes
Super User
Super User

@cvazquc3 

So if you are using an Form, then all of the work is done for you.

Typically, instead of popping up lots of Notify messages, the preferred method is to simply set the datacards you are checking for Blank to be required (Required - true).  The form will then notify the user directly in the form.

 

As for your Formula:

1) Again, all of the If statements can go away if you just set those datacards to Required.

2) SubmitForm is pretty much the only thing you need in your submit button.  Except in your case you will want to wrap that to test the connection:

If(Connection.Connected && NewForm_1.Valid,
    SubmitForm(NewForm_1),

    Notify("La conexión de internet ha fallado, revise su conexión", Warning, 5000)
)

3) You do not need to do a Refresh statement on the datasource...it will already be updated.

4) The OnSuccess action of NewForm_1 should be set to:

Notify("Elemento guardado", Success, 4000);
ResetForm(NewForm_1)
Navigate(BrowseScreen1, Cover);

 

_____________________________________________________________________________________
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!

Randy, could you please this image attached?

RandyHayes
Super User
Super User

@cvazquc3 

Make sure that all of the Update properties in your datacards are referencing the proper controls and converting as required to any data type that is needed for your datasource.

_____________________________________________________________________________________
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!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,226)