Add creation date to documents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EGS-plan
    Junior Member
    • May 2022
    • 2

    Add creation date to documents

    Hello everyone,

    As you can see on the screenshots, we would like to add a date display next to the "Documents" entry that shows us when the document was inserted. How can we realize this?

    Best regards
    EGS-plan
    IT department
  • Vadym
    Super Moderator
    • Jun 2021
    • 346

    #2
    Hi EGS-plan,

    Such logic can be easily implemented via Workflow feature from an Advanced Pack and Formula.

    Instruction:

    1. At first, go to `Administration -> Entity Manager -> Contact -> Fields create "inserted" Date-Time type field, set "Read-only" for it.
    2. Add "inserted" field to the detail view via Layout Manager opposite "Documents" field (Administration -> Entity Manager -> Contract Layouts -> Detail).
    3. Create a Workflow rule for Contract entity with `After record saved (created or updated)` Trigger Type and `Update Target Record ยป Contact` action with the following Formula:
    Code:
    $parentId = record\findOne('Attachment', 'createdAt', 'desc', 'parentId=', id, 'parentType=', 'Contract');
    inserted = record\attribute('Attachment', $parentId, 'createdAt');
    More information about Workflows you can find here:


    More information about Formula you can find here:


    EspoCRM Documentation:
    Attached Files

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1607

      #3
      I solved the same problem in another entity simply by formula:

      Code:
      ifThen(
             entity\isNew(),
             created = datetime\today()
      );
      Is that wrong? Because it works.
      I furthermore set the field condition to be write protected after creation (field is not empty), so the date cannot be changed afterwards. Read only would work as well.

      Another possibility could be to set the default for this field to "today", also works.

      Comment

      Working...