File upload field in custom form

Hi,
We have installed primero in our system and started using it.

We have created some of the custom forms and we want file upload field to be added in that.
How can we achieve the same?

Helpdesk issue was created by Ian Lawrence: File upload field on custom form

New public comment was posted to Helpdesk by Ian Lawrence

Anything to do with file attachments has to be done through JSON. (export the configuration bundle using the UI) However, we may have done some hardcoding, so there is a high risk of issues if you put file attachments on any other form besides the current ones

I have created many custom form and each form should have a field for file upload. Please if it possible for you to explain with proper details how to add file upload field in each form.

First export a configuration bundle. To do that look at the docs here https://support.primero.org/books/primeroIMS/PrimeroConfigurationProcessGuide/master/PrimeroConfigurationProcessGuide.html#configure. Inside you will find something which looks like this for upload fields.
“fields”: [
{
“visible”: true,
“mobile_visible”: true,
“highlight_information”: {
“highlighted”: false
},
“multi_select”: false,
“required”: false,
“show_on_minify_form”: false,
“hidden_text_field”: false,
“autosum_total”: false,
“autosum_group”: “”,
“create_property”: true,
“hide_on_view_page”: false,
“name”: “upload_bia_document”,
“type”: “document_upload_box”,
“editable”: false,
“disabled”: true,
“display_name_en”: “BIA Document”,
“display_name_fr”: “BIA Document”,
“display_name_ar”: “BIA Document”,
“display_name_es”: “BIA Document”,
“base_language”: “en”
}

On your custom forms you need to make something like this for an upload field.

As per above suggestion, I am able to create upload field in form.
Uploaded file is accessible in edit section, but in view section of the form, I am not able to view the uploaded file.
As its a BIA Document type I request for approval even after approving the document the red Exclamation sign doesn’t go and still, I was unable to see my document
Is there any way to access/view uploaded file in the view section?
Awaiting reply on the same.
Thanks.

This is probably related to permissions. What permissions does the role have to view?

Can you please suggest what permission it should have to view the document uploaded?

The role needs to have the view permission.Note that:

To edit the properties of an existing role, find the name and click Edit in the options in the right column. From the Show page, click the EDIT button at the top of the screen… Click on the SAVE button once all the desired information has been changed or entered.

A few hints for setting roles:

  • When creating the role, if you do not check any forms, users with this role will see the default set of forms for the modules assigned when their username is created. However, if you check even one form in Case, Incident, or Tracing Requests, you must click all the forms the role should access in all three groups of forms.
  • Record Owner is a required form. If you are selecting forms, you must include Record Owner with any other forms within the group otherwise users with this role will be crippled. The Record Owner form must be selected within each group of Case, Incident and Tracing Request forms. Selecting it once is not adequate.
  • The list of forms for Cases contains forms for both the CP and GBV modules and, likewise. For the user to see the form, the role must have access to the form and the username must have access to the module.