Record Delete Function Suggestion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    Record Delete Function Suggestion

    It is almost not possible to delete a record using formula, is there any chance to have a formula function that does that (delete a given record), like below:

    record\delete(ENTITY_TYPE, ID, [filter optional])

    If filter is added then it will be easy to loop through a collection of Ids and delete only record that much the given filter.

    Thanks
    Rabii
    Web Dev
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2

    application/Espo/Core/Formula/Functions/RecordGroup/CreateType.php
    application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedManyType.php


    one line in each files to change and then become : RemoveType, RemoveRelatedManyType
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • yuri
      Member
      • Mar 2014
      • 8453

      #3
      This works for a target entity:

      Code:
      deleted = true;

      This should work for any entity (did not test though):
      Code:
      record\update(ENTITY_TYPE, ID, 'deleted', true);
      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

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        thanks yuri
        Code:
         record\update(ENTITY_TYPE, ID, 'deleted', true);
        works fine.
        Rabii
        Web Dev

        Comment

        • Laimonas
          Senior Member
          • May 2021
          • 197

          #5
          yuri I've noticed that "deleted = true;" stopped working in scheduled workflows. We used to delete old emails using "deleted = true;" in the scheduled workflow, but now it is not working. "deleted = true;" is still working in the Entity formula and create/update workflow, but no longer in the scheduled workflows. Is there a reason for that?

          Update: record\update(ENTITY_TYPE, ID, 'deleted', true); is working on scheduled workflows, I've just tested it.
          Last edited by Laimonas; 12-29-2022, 01:43 PM.

          Comment

          Working...