Read-only records after some time of creating them

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jgarcia
    Junior Member
    • Aug 2023
    • 18

    Read-only records after some time of creating them

    Hi, I have a query on how to make the records of an entity read-only (they cannot be edited by any user) after 1 year of creating them. I appreciate any contribution​.​​
  • Jakub Grufik
    Senior Member
    • Aug 2022
    • 361

    #2
    I am not sure but maybe you can do the magic in the entityDefs json



    You can find the json of the entityDef in /custom/Espo/Custom/Resources/metadata/entityDefs

    How to use if statement inside JSON Here is the code: ....................................................................................... var config = [ { ...


    But I am not sure if you can modify readOnly attribute for all the fields..

    Comment

    • lazovic
      Super Moderator
      • Jan 2022
      • 810

      #3
      Hi jgarcia,

      There is a workaround, the installed Advanced Pack extension is required:

      1. Create "Access to entity name" team and assign it to all users (via Mass Update).
      2. Bind this team to all records of the entity name type (via Mass Update).
      3. Change the Role for all users so that access to editing the entity name records was only of the team type.
      4. Create report with entity name Target Entity with filter Created At greater than one year.
      5. Create a Workflow with:
      • Target Entity: entity name
      • Trigger Type: Scheduled
      • Target Report: the report created in step 4
      • Scheduling: 0 0 * * *
      • Action:
      ​​Click image for larger version  Name:	image.png Views:	0 Size:	10.5 KB ID:	96351
      (instead of Opportunity choose entity name;​ in the formula, replace the team-id with the id of the created team in step 2)


      Thus, the team should be removed from the record after it is one year old, and users will have read-only access to records of entity name type.

      Comment


      • Jakub Grufik
        Jakub Grufik commented
        Editing a comment
        wow, such a creative solution, but should be working :thumbsup:
    • jgarcia
      Junior Member
      • Aug 2023
      • 18

      #4
      Thank you, I will apply these solutions and see what the results are.

      Comment

      Working...