Roger Blanchard
447 posts
Registered:
29 Jun 2018
26 Feb 2019
Link to this post
We are using the FetchRelatedRecord in our BE with the code below. It works fine when a record was created or updated. However, If a record was deleted it does not fall into the FOR EACH eTagItem loop. I tried adding a FOR EACH eTagItemBefore and while the record is found the call to FetchRelatedrecords fails. Should this method work for a before buffer?
FOR EACH eTagItem WHERE ROW-STATE (eTagItem) <> ROW-UNMODIFIED ON ERROR UNDO, THROW:
THIS-OBJECT:FetchRelatedRecords (BUFFER eTagItem:HANDLE, "eTagHdr").
IF NOT AVAILABLE eTagHdr THEN // we need our parant record to continue validation
DatasetHelper:AddErrorString (BUFFER eTagItem:HANDLE, SUBSTITUTE ("TagHdr record not found with BatchId=&1", etagItem.BatchId), "BatchId", "eTagItem") .
END.
FOR EACH eTagItemBefore WHERE ROW-STATE (eTagItemBefore) EQ ROW-DELETED ON ERROR UNDO, THROW:
THIS-OBJECT:FetchRelatedRecords (BUFFER eTagItemBefore:HANDLE, "eTagHdr").
END.