cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cymek11
Frequent Visitor

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
Frequent Visitor

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
v-xida-msft
Community Support
Community Support

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.

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.

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
Frequent Visitor

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

 

Form 'Item' needs to be set to:

Defaults(IncidentFiles)

View solution in original post

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (47,865)