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.
Solved! Go to Solution.
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.
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
I tried changing it to
with the same results.
On the attached screenshots, the only difference in code is:
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.
Gallery connected to SQL
Arrow on the Gallery1
Form connected to SP List
Form Datasource "Incident Files"
When I click the arrow I get (see attachment 1.jpg)
Later I change the arrow code to:
I get (see attachment 2.jpg)
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.
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.
We are excited to announce that Demo Extravaganza for 2021 has started!
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks