cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cymek11
Level: Powered On

Add/Remove attachments (Edit Form, View Form)

Hello,

 

I have an app for incident collection and reporting, one of the functions is adding attachments, a witness statement or a picture. The attachment control is in a form, and stores all the attachments in Sharepoint list, along with record ID, the rest of th data is stored in on-premise SQL.

 

Storing the documents in SP list works flawlessly

 

Within the app I also have a feature to recall (view or edit) the incident details as well as the attachements. I can update the details but I am having a hard time getting the attachment add/remove to work. Here is my issue:

 

From what I understand, to edit (add/remove) attached files, the attachment control needs to be inside a form, and it needs to be attached to a list, and the form HAS to be in Edit mode. My issue is when the Form is in Edit or View mode the attachment control is greyed out. The only way to see items attached, is to have the form in New mode.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
cymek11
Level: Powered On

Re: Add/Remove attachments (Edit Form, View Form)

Ok, my colleague just fixed it. Here it is:

 

Form 'Item' needs to be set to:

Defaults(IncidentFiles)

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Add/Remove attachments (Edit Form, View Form)

Hi @cymek11,

Which data source does your Edit form connect to? A SP list or a SQL table?

How do you save your data into your SQL table and save your attachments file into your SP list?

If your Edit form is connected to your SP list, I have made a test on my side, I don't have the issue that you mentioned.

Based on the second screenshot that you provided, I think the Attachments control within your Edit form could not retrieve proper data from your SP list. Please check if the Default property of the Attachments control or the Default property of the Data card control which contains the Attachments control is set to proper formula.

In addition, please also consider take a try to set the Default property of the Data card control which contains the Attachments control to following:

LookUp('YourSPList', ID = Value("A specific record ID")).Attachments

then check if the issue is solved.

If the issue still exists, please consider take a try to re-create your app, and connect the Edit form to your SP list, check if the issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cymek11
Level: Powered On

Re: Add/Remove attachments (Edit Form, View Form)

The Edit form connects to the same SP List as the New form. As a matter of fact, new form and edit form are the same forms, I just change the mode with 'NewForm(Attachment_Form)' or 'EditForm(Attachment_Form)', depending on the function needed (ie. if I need to add/delete attachment, I change the mode to EditForm, if only viewing record I set the mode to view so the user cannot delete any attachments, based on security rights)

 

I save the SQL data with Patch function, and SP List with SubmitForm.

 

My Attachment_Form is connected to the SP List (IncidentFiles)

Attachment default property is set to 

ThisItem.'{Attachments}'

I tried changing it to

LookUp(IncidentFiles,ID=Gallery1.Selected.Id).'{Attachments}'

with the same results.

 

On the attached screenshots, the only difference in code is:

  1. NewForm.JPG - when the item is selected from gallery, the form mode is set to NewForm(Attachment_Form)
  2. Edit View Form.JPG - when the item is selected from gallery, the form mode is set to ViewForm(Attachment_Form) or EditForm(Attachment_Form) (both have the same result)

Thanks

 

I will try creating a test app, with the same function to see if it makes a difference. Re-creating the whole app is not feasible.

cymek11
Level: Powered On

Re: Add/Remove attachments (Edit Form, View Form)

So I created a test app.

Screen1:

Gallery connected to SQL

LookUp('[dbo].[Incident Report]',Id=115)

Arrow on the Gallery1

NewForm(Form1);Navigate(Screen2,UnCover)

Screen2:

Form connected to SP List

Form Datasource "Incident Files"

Attachment Control

LookUp('Incident Files',IncidentID=Gallery1.Selected.Id).Attachments

When I click the arrow I get (see attachment 1.jpg)

Later I change the arrow code to:

EditForm(Form1);Navigate(Screen2,UnCover)

I get (see attachment 2.jpg)

cymek11
Level: Powered On

Re: Add/Remove attachments (Edit Form, View Form)

Ok, my colleague just fixed it. Here it is:

 

Form 'Item' needs to be set to:

Defaults(IncidentFiles)

View solution in original post

Community Support Team
Community Support Team

Re: Add/Remove attachments (Edit Form, View Form)

Hi @cymek11,

Have you solved your problem?

If you have solved your problem, , please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 283 members 1,991 guests
Please welcome our newest community members: