This content has been marked as final. Show 3 replies
Part of the problem is that the When-Validate-Item (WVI) trigger does not allow execution of Restricted Built-ins. The Clear_Record and Delete_Record built-ins are Restricted; which means you can't call them from the WVI trigger. You can get around this limitation by capturing the record number of the row to clear and then creating a timer in your WVI trigger and then call the Clear_Record or Delete_Record built-ins from the When-Timer-Expired (WTE) trigger. For Example:
/* When-Validate-Item trigger */ DECLARE tID TIMER; BEGIN /* Your Validation Logic goes here */ ....... IF <Duplicate Record Found> THEN /* Capture the record to be cleared */ :Global.Dup_Record := :System.Trigger_Record; /* Create a timer with a 100 Millisecond delay */ tID := Create_Timer('DUP_RECORD', 100, NO_REPEAT); END IF; END;
You might also want to take a look at the Avoid duplicate Records in a Block article as this method gives you a method to check for duplicates that are only in your Form and have not been commited to the database yet.
/* When-Timer-Expired trigger */ DECLARE tID TIMER; BEGIN tID := Find_Timer('DUP_RECORD'); Go_Block('MY_BLOCK'); Go_Record(:GLOBAL.Dup_Record); Clear_Record; END;
Hope this helps,
If a response is helpful or correct, please mark it accordingly.