How to work with onBeforeDelete and onAfterDelete?

Hello all,

I have a relationship item type server event of onAfterDelete that runs some post processing for respective deletion.

Only thing is, right now, even with commented out code, I am unable to successfully have the deletion go through successfully. To reiterate, after removing the row and pressing save, the row stays there faded out and is still technically there and reappears back in full color after relogging back into Aras.

Firstly, even when I remove my onAfterDelete method and use only my onBeforeDelete method that simply states "return true", the record stays faded out?

Secondly, if I can get onBeforeDelete to allow processing, how can I pass the data of onBeforeDelete to onAfterDelete - there is important data in the relationship record that cannot be fetched by the AML server within onAfterDelete, so I need a way to pass it.

Best Regards,

Frank

Thanks!

Parents
  • In general, there are certain server related actions that die silently without any or only an limited error message to the front end. 

    I am unsure why you get a "return true". It´s what a client side relationship Method would return, but I don´t remember right now. 

    The most important thing you need to know about onBefore/AfterDelete is that you cannot use the regular context item (this). You don´t have a context item after deleting cause it´s obviously gone. And you only have a limited context item before deletion (only type + id).

    A proven strategy is to pass the needed properties from the onBefore to the onAfter Method via a session state variable. 
    See programmers guide: 8.26 How to Pass Values from onBeforeX to onAfterX Events.

    Edit: If you found this answer useful, I would appreciate your feedback in my recent poll :)

     Multiple sessions created for trivial actions like "edit". What can be the reason? 

  • オフライン in reply to AngelaIp

    Sorry, I can't help, we don't use thumbnails for any item type of ours. I voted as such

Reply Children
No Data