Announcement

Collapse
No announcement yet.

Change "file storage" for a specific "file" field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change "file storage" for a specific "file" field

    Hi there,

    I recently added multiples file storages "types" to my EspoCRM (following this post https://forum.espocrm.com/forum/deve...urgent-problem).
    Everyone of my "custom" file storages are just there to split the different upload files on my CRM (So It's like 'data/upload/something' for all of them).

    So I'm looking for a way to tell the CRM that if someone fill a file into a specific field into a specific entity, this file must be stored in the "Something" storage and not the default one.

    Kind regards,
    Firyo.

  • #2
    Hi,

    You can set 'storage' attribute for an attachment entity in a before-save hook.

    Comment


    • #3
      Hi yuri,

      Okay, I've created an override for the "Attachement" repository class and called a function before the call of the function "processBeforeSaveNew".

      Now I wanted to know, is the "Attachment" entity meant to be linked to multiple entities ?
      I'm asking this because when I remove the link between one of them the Attachement itself is removed but still shown as linked in the other linked entities.

      Comment


      • #4
        Ok, after some research I apears that an Attachment is meant to be linked to only one entity.

        Comment


        • yuri
          yuri commented
          Editing a comment
          Correct. Attachment record can be duplicated with its sourceId referring to the original to prevent necessity to duplicate an actual file.

        • Firyo
          Firyo commented
          Editing a comment
          Ok, in this case I'll edit my procedure that was using the same Attachment for multiple entities.
      Working...
      X