"Removing" an entity (after data entry) but not the entries in the many-to-many table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murugappan
    Active Community Member
    • Aug 2017
    • 467

    "Removing" an entity (after data entry) but not the entries in the many-to-many table

    Hi,

    This is my scenario:

    (1) I created an entity "Users"
    (2) I created an entity "Roles"
    (3) I defined a many-to-many relationship between "Users" and "Roles" which created a Users-Roles cross table. A "User" can have many "Roles" based on applications and vice-versa.
    (4) I defined all the "Roles" a "User" can have on creating a "User".
    (5) When i "remove" the "User", the "deleted" field in "Users" is set correctly but the "deleted" fields in the related Users-Roles cross table was not set and remained undeleted.
    (6) I created the same User but did not assign any Roles.
    (6) My other application retrieves the User and Roles information, I get the User Info correctly but the orphaned entries in the cross table also comes along which is incorrect.

    I posting this under Bug Reports because i think this should not happen and the "deleted field" in the cross table should also be updated. I am not sure if this is done as scheduled job. If it, please advice when does the schedule job run and which job?
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    Not a bug,

    They are removed by the cleanup job. The parameter 'cleanupDeletedRecordsPeriod ' https://docs.espocrm.com/administrat...rams/#clean-up
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • murugappan
      Active Community Member
      • Aug 2017
      • 467

      #3
      Hi yuri

      Thank you for the update. Unfortunately, the "deleted" field is not set to 1 when the the user removes the holding entity. I have 2 questions:

      (1) Will the cleanup job clean up when the deleted field is not set in the cross table?
      (2) If the cleanup is run weekly, there we will still be orphaned rows in the cross-table. This is a common problem faced by many developers. Is it possible to provide a stored procedure in the holding entity to set the deleted field in the cross-table?

      Thank you in advance.

      Comment

      • murugappan
        Active Community Member
        • Aug 2017
        • 467

        #4
        I am closing this post for 2 reasons as i see that there are no further valuable updates and i have answered the questions myself.

        Comment

        Working...