read ID of document to insert in other entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    read ID of document to insert in other entity

    Hello,
    I have an entity, wich is related to documents, where I keep images in various resolutions. There is always one big file for high quality printing. When I want to send that file, it is not possible to attach the file directly to an email, because it is too big. So I would need a link to that file, that would be created by formula in that entity for I could put it into an email template.
    Manually I can do that by copying the ID of that file and construct the URL of the file link. But I did not succeed to read the ID directly from the respective document to set in the field of the entity.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    Do you mean how to get the attachment ID automatically by a formula script?
    What relationship type do you have between your entity end the Document entity? Is it One-to-Many? If so, I am afraid that there is no ebility to achieve it via UI. You need to create a hook to fetch the file_id value form the respective Document.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1602

      #3
      Hi, I did not decide yet the type of relationship, I think 1:1 would be ok? Because one record in the entity has only one document associated.
      How to make a hook, I never understood unfortunately.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        One-to-One is perfect, cause it allows you to fetch file_id value right from the related Document. So you will not needed any hook here.

        Comment

        • shalmaxb
          Senior Member
          • Mar 2015
          • 1602

          #5
          Maximus Thank you, that worked: One-to-One relationship, one relationship link field to select the document, one read only field for output of ID, one field for construction adress part configured with default output (without ID) and a read only field, that concatenates ID field and adress construction field to the needed link by formula.
          ID field and address construction field can be hidden in the detail view. When you select a document, the respective link appears automatically.

          Comment

          Working...