Access record after @delete event

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • yuri
    replied
    You should be able to access attributes of a deleted record with entity\attribute('attributeName'); But I'm not sure.

    I'd recommend using a workflow rule for such simple tasks.

    Leave a comment:


  • Maarten
    replied
    I've slimmed it down to a very basic workflow, that catches a @delete event, and calls a BPM process that creates a notification.

    Click image for larger version  Name:	image.png Views:	0 Size:	45.3 KB ID:	94940

    The Travel event that I'm removing has this id: 64a24fea1f9d88514

    I am seeing the flow trigger:
    Click image for larger version  Name:	image.png Views:	0 Size:	103.2 KB ID:	94933​ ​
    The notification is sent fine if I create the notification directly in the workflow, instead of the BPM process that is called by the workflow.

    This sounds like a bug?

    I'm on Espo 7.5.5
    PHP 8.2.4 (cli)
    Last edited by Maarten; 07-03-2023, 03:28 PM.

    Leave a comment:


  • rabii
    commented on 's reply
    can you share your code and flowchart ? is the target entity for the flowchart is the same entity type that gets deleted ?

  • Maarten
    replied
    Hi Rabbi,

    Thanks for your response. I've tried the 'deleted' true filter on a record that was deleted, but it returns a null still.

    You code also suggest that the $id returned by record\findOne is different from id. But shouldn't they not be the same?






    Leave a comment:


  • rabii
    replied
    Originally posted by Maarten
    I have a workflow that catches the @delete event. I want to be able to take an action following this event, for which I need some attributes from the deleted record. However, the record is not available anymore, and I'm getting thrown null errors in the logfile.

    Is there a way to access attributes from deleted records?
    you can try something like below (just as example) apply your own entity instead of opportunity:

    PHP Code:
    $id record\findOne('Opportunity''createdAt''desc''id='id'deleted'true);

    $name record\attribute('Opportunity'$id'name'); 
    You can still access the deleted record using (deleted = true).

    hope this helps

    Leave a comment:


  • abidoss
    replied
    can you share the log file?

    Leave a comment:


  • Maarten
    started a topic Access record after @delete event

    Access record after @delete event

    I have a workflow that catches the @delete event. I want to be able to take an action following this event, for which I need some attributes from the deleted record. However, the record is not available anymore, and I'm getting thrown null errors in the logfile.

    Is there a way to access attributes from deleted records?
Working...