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

Patch button giving Attachments ID required error on first press, second press it works fine?

I have an app connected to a SharePoint list with a button that patches several edit-forms into the list.

 

Recently I've started having an issue with the Attachments field giving an "ERROR FIELD ID IS REQUIRED" for the attachments field when using a Patch statement to submit the form to SP.


If i click the button a second time, it submits just fine - it's only the first time I open the form and try to submit. (Or on the first try, if I attach something even though it's not a required field, everything submits okay).

 

I have other apps using attachments and never have run into this issue, I've compared almost every property including Items / Default etc. and i can't find a difference? 

 

Any assistance would be helpful as this is preventing me from releasing my app. 

5 REPLIES 5
drewski
Helper I
Helper I

Simple patch statement that fails the first press of a button, but works the second time the button is pressed

 

Seems strange no? 

 

Patch(
'Service Intake Form',
Defaults('Service Intake Form'),
efrmPolicyDetails_1.Updates)

v-qiaqi-msft
Community Support
Community Support

Hi@drewski,

Could you please share a bit more about your scenario, any screenshots about the error?

Current information could not help to get the whole scenario.

Besides, the formula you provided is correct.

So far, all I can think of is maybe a page rendering issue. Please try to close the App and restart again to see if it resolves.

Best Regards,

Qi

 

 

Best Regards,
Qi

drewski_0-1597892868762.png

drewski_1-1597892913087.png

These are the errors I see the first time I click submit (with or without an attachment), then if i click Submit again, everything works fine

 

If i attach something the before I click submit the first time, it works. So it's like it thinks its required or has validation but it doesn't. I've deleted this attachments field and re-added, nothing seems to work. 

Hi@drewski,

This is so weird.

Try to remove the connection and close the App.

Restart the app and add the previous connection.

This situation is a bit complicated because of the many reasons back to this situation. For example, network problems, Power Apps connection problems, many times we may need to go through each and every one of them. If you want to be more efficient, consider opening a ticket.

Best Regards,

Qi

Best Regards,
Qi
AsaurdiffADTill
Frequent Visitor

So this still hasn't been answered, but I have found a fix. 

 

I wrote an application that utilized the Add a Photo button, a gallery, and an Attachment box. All the images I collected, whether from a camera or File Explorer will be collected into a local collection then patched through the form.updates in Patch. 

 

First, Change your MediaButton.OnSelect to: 

On Select = Collect('Collection name', { Id: Mediabutton.media, Name: 'unique image name', AbsoluteUri: Mediabutton.media})

Set your Attachment control items: 

Items = 'Collection Name'

the hidden form.attachment data card control update

Update = 'External Attachment control'.Attachments

and then patch data alongside your other patch content:

patch('SPO list name',Defaults('SPO list name'),{columnname: 'data'....}, Form.updates)

 

Before I was receiving the same error as you. But once I created the Attachment object with the collected data aka id, name, AbsoluteUri, It took the data. 

 

ALSO if you want to know how I created the unique image name I took data from another identifying field I was using and concatenated it with a date and set a variable onVisible to 0 then did a +1 to increment it on every image add. This may not really apply to you, but you may be able to adapt it. 

MediaButton.OnSelect = updateContect({ImageName: Concatenate('Selected identifying item'.name,Text(Today(),"MM-dd-yyyy"),Text(ImageNum)),ImageNum: ImageNum+1})

 

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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