This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - user deletes an affected item off an ECR, how to tell which item it is

Ron - Tuesday, April 26, 2011 3:50 PM:

Looking for a way to tell if a user deletes an affected item off an ECR. We have a method that captures when an item is added to an ECR, places a pending status on the affected item (Part or Document) but so far we have not been able to detect if a row (item) has been deleted which we need to know in order to clear the pending status. The method we are using is triggered using the OnAfterAdd, OnAfterUpdate as well as thru the ECR lifecycle so that at the end of the ECR workflow a method is used to clear the pending flag from all items on the ECR. The problem we have is detecting which item on the ECR is flagged to be removed when a user edits the ECR and deletes an item.

 

Any help would be greatly appreciated  

 

Ron



Brian - Sunday, May 1, 2011 5:58 AM:

Hi Ron,

I would try an 'onAfterDelete' method on the Relationship Item (ECR Affected Item). When the row is deleted you should be able to tell what it was and update the flag. If that doesn't work then you may need to use an 'onBeforeDelete' and be prepared to reverse it if the delete fails for some reason.

Cheers,

Brian.



Nick - Monday, May 2, 2011 9:13 AM:

This is actually exactly what I ended up doing. I put a server method on onBeforeDelete and after a little tweaking it worked fine. You need to take this.getID() and re-query the ECR Affected Item for some reason, if you just use this.getProperty("related_id") it won't return anything.