I have the following code on a button's WHEN-BUTTON-PRESSED
trigger
BEGIN
SYNCHRONIZE;
populate_maximo_records;
END;
There will be a scenario that there will not be any records ti populate in block. If there are no records, currently it is throwing the following error message
frm-40350 query caused no records to be retrieved
Instead, I would like to suppress the above message and display a customized message. How can I do this?
You can use the On-Message or On-Error trigger to trap any internal forms message or error. FRM-40350 is classified as type informative (can be checked in Forms help) so it has to be handled in On-Message trigger. The code for trapping the message should be something like this:
IF message_code = 40350 THEN
Message('Your custom message');
ELSE
Message(message_type||'-'||TO_CHAR(message_code)||':'||message_text);
END IF;
Please notice that 'On' triggers replaces implicit form functionality so if you in the example leave out the ELSE statement then you will hide all other forms messages! With the On-Error trigger it is essential that you remember to use RAISe after displaying your own message otherwise forms will continue as the error never had happened!
IF error_code = 50026 THEN
Message('My Own message');
RAISE FORM_TRIGGER_FAILURE;
ELSE
Message(error_type||'-'||TO_CHAR(error_code)||':'||error_text);
RAISE FORM_TRIGGER_FAILURE;
END IF;