Announcement

Collapse
No announcement yet.

Record Delete Function Suggestion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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

    Comment


    • #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);

      Comment


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

        Comment


        • #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...
          X