Hello, I’m trying to add a file type field to a custom module. To this end, I have made the record view use legacy mode
config/services/module/module_routing.yaml
my_custom_module:
index: true,
list: true,
record: false
I have followed this guide.
Specifically from the guide I have implemented the following
At public/legacy/custom/Extension/modules/my_custom_module/Ext/Vardefs/file.php
<?php
$dictionary["my_custom_module"]["fields"]["filename"] = [
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'file',
'dbType' => 'varchar',
'len' => '255',
'reportable' => true,
'comment' => 'File name associated with the note (attachment)',
'importable' => false
];
$dictionary["my_custom_module"]["fields"]["file_mime_type"] = [
'name' => 'file_mime_type',
'vname' => 'LBL_FILE_MIME_TYPE',
'type' => 'varchar',
'len' => '100',
'reportable' => true,
'comment' => 'File name associated with the note (attachment)',
'importable' => false
];
$dictionary["my_custom_module"]["fields"]["file_url"] = [
'name' => 'file_url',
'vname' => 'LBL_FILE_URL',
'type' => 'varchar',
'source' => 'non-db',
'reportable' => false,
'comment' => 'Path to file (can be URL)',
'importable' => false
];
Then I repair and build and then add the new field in the module edit view.
The input file field is effectively added and the record is persisted. But in the detail view when I click on the file I get this message
Invalid File Reference
in this url
http://crm.local/legacy/index.php?preview=yes&entryPoint=download&id=7e3d9bbe-f612-b6bf-cc34-65cc3db2b552&type=my_custom_module
I also notice that there is no way to delete the attachment.
Thanks in advance for any ideas