Moving a file from a file field to a Attachment-Multiple field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esendino
    Senior Member
    • May 2019
    • 158

    Moving a file from a file field to a Attachment-Multiple field

    I'm trying to pass files already loaded from a file field to another field through a BPM.


    When both fields are file fields t(https://docs.espocrm.com/administration/fields/#file), there is no problem. I do it like this:

    originField is a File field
    destinationField is a File field
    $prFileId = originFieldId;
    destinationFieldId = $prFileId;


    The problem appears when I move from a File field to a Attachment-Multiple field (https://docs.espocrm.com/administrat...hment-multiple). In this case the Ids of the files is an array. Si I managed it this way:

    originField is a File field
    destinationField is an Attachment-Multiple field
    $prSeveralFileIds = list();
    $prFileId = originFieldId;
    $prSeveralFileIds = array\push($prSeveralFileIds, $prFileId);
    destinationFieldsIds = $prSeveralFileIds;

    The problem is that, once executed, I don't find the files in destinationField.


    I made the same test the other way round. Moving from a Attachment-Multiple field to a File field

    originField is an Attachment-Multiple field
    destinationField is a File field
    $prSeveralFileIds = originFieldIds;
    $prFileId = array\at($prSeveralFileIds, 0);
    destinationFieldId = $prFileId;

    In this case, it works perfectly.

    Thank is advance for your help.

    Note:

    There are no limitations defined neither on the Max File Size nor the file types that can be accepted.
    The testing has been made with pdf files sized around 400Kb.





  • esendino
    Senior Member
    • May 2019
    • 158

    #2
    hi yuri may you have a look at this, please?

    Thanks in advance

    Comment

    • esendino
      Senior Member
      • May 2019
      • 158

      #3
      Hi. Any advice on how to feed files to a Attachment-Multiple field in a BPM context?

      Comment

      Working...