cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chiranjay
Helper II
Helper II

PowerApps Attachment Control Doesn't Reset After Form Submission and Keeps an old attachment

Hi Team,


I am experiencing an issue with PowerApps - Attachment Control.

 

I have created this app using a SharePoint List.

 

When I submitted an instance of the PowerApps Form I built as an item, the attachment control keeps and an old attachment as an attachment. This old attachment is not with us anymore but the form manages to show it after the submission.


To submit I'm using a button named 'Submit'

My current property values are as the below.

Attachments_DataCard1
1. Reset property - True.
2. Items property - Parent.Default
3. Default - ThisItem.Attachments
4. DataField - "{Attachments}"
5. DisplayMode - Parent.DisplayMode

AttachmentsDataCardValue
1. Reset - True
2. Items - Parent.Default
3. Default - Empty

 

Form Properties
1. Default mode - New


Submit Button
OnSelect - SubmitForm(SharePointForm1)&&NewForm(SharePointForm1)

I tried even OnSelect - SubmitForm(SharePointForm1)&&ResetForm(SharePointForm1)&&NewForm(SharePointForm1)


I can't understand the issue.

Please can someone help me with this?

Kind regards,
Chiranthaka

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@chiranjay 

First, your OnSelect of the submit button should ONLY be SubmitForm.  SubmitForm occurs in the background, so once the function is initiated, it continues to then evaluate the rest of your formula.  Issuing a NewForm or Reset or anything else immediately after the SubmitForm can impact the form itself before the SubmitForm has completed.

Also, by doing that kind of thing, you are assuming that the record will submit successfully.  It may not!!  And from a user perspective, if it fails and they need to correct something...you just wiped out everything and they have to do it all over again.

You should be utilizing the OnSuccess and OnFailure actions of your form.  In this particular case, your OnSuccess action should contain the function:  ResetForm(SharePointForm1)

Since the default mode of the form is New mode, it will reset the form back to that.

 

Next, separate your chained function with a semicolon. Using a Boolean AND (&&) is not useful as the formula will try to evaluate all of the results of the functions you have...and the functions you have do NOT return any values.

If your region is not US, you might need to use two semicolons between.  This is dependent on your regional language settings.

 

Next, your Reset properties should not be set to true.  Controls reset WHEN the Reset property goes to true.  If it stays at true, it will never reset again.  By default they should be set to false.

So change those first!

 

I hope this is helpful for you.

You are showing an Items property for your attachments datacard.  The Datacard does not have an attachment property, so I am not sure if this was just a mistake or if you are seeing something inaccurate. 

 

_____________________________________________________________________________________
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

6 REPLIES 6
RandyHayes
Super User
Super User

@chiranjay 

First, your OnSelect of the submit button should ONLY be SubmitForm.  SubmitForm occurs in the background, so once the function is initiated, it continues to then evaluate the rest of your formula.  Issuing a NewForm or Reset or anything else immediately after the SubmitForm can impact the form itself before the SubmitForm has completed.

Also, by doing that kind of thing, you are assuming that the record will submit successfully.  It may not!!  And from a user perspective, if it fails and they need to correct something...you just wiped out everything and they have to do it all over again.

You should be utilizing the OnSuccess and OnFailure actions of your form.  In this particular case, your OnSuccess action should contain the function:  ResetForm(SharePointForm1)

Since the default mode of the form is New mode, it will reset the form back to that.

 

Next, separate your chained function with a semicolon. Using a Boolean AND (&&) is not useful as the formula will try to evaluate all of the results of the functions you have...and the functions you have do NOT return any values.

If your region is not US, you might need to use two semicolons between.  This is dependent on your regional language settings.

 

Next, your Reset properties should not be set to true.  Controls reset WHEN the Reset property goes to true.  If it stays at true, it will never reset again.  By default they should be set to false.

So change those first!

 

I hope this is helpful for you.

You are showing an Items property for your attachments datacard.  The Datacard does not have an attachment property, so I am not sure if this was just a mistake or if you are seeing something inaccurate. 

 

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

Thanks, @RandyHayes for helping out with this issue. It's a solid one.

chiranjay
Helper II
Helper II

@RandyHayes 

 

I was wondering, are there any other solutions to resolve this issue? Like using a formula or similar?

 

The solution you gave previously is working by the way.

 

Thanks

Chiranthaka 

RandyHayes
Super User
Super User

@chiranjay 

What is the issue you are having at this point?

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

Hi @RandyHayes ,

Sometimes the attachment control is not resetting. This happened in a different form not the one I had this issue at first. 

As per your instructions I changed the properties but it didn't reset properly.

 

Thanks,
Chiranthaka

@RandyHayes This option is not working anymore 😪.
Can you suggest a different solution for this issue, please?

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.

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,882)