Hi @Ed22,
Here's how the PL/SQL block should look for this event action in IFS Cloud:
DECLARE
print_tax_code_text_ VARCHAR2(5);
invoice_id_ NUMBER;
identity_ VARCHAR2(20);
BEGIN
-- Get the identity from the new invoice being created
-- (adjust parameter name based on your event's available parameters)
identity_ := :IDENTITY; -- or :CUSTOMER_ID depending on event parameters
-- Query the VIEW to check the switch value
BEGIN
SELECT print_tax_code_text
INTO print_tax_code_text_
FROM identity_invoice_info
WHERE identity = identity_;
EXCEPTION
WHEN NO_DATA_FOUND THEN
print_tax_code_text_ := 'FALSE'; -- treat missing record as FALSE
END;
-- If the switch is FALSE, raise an error to block invoice creation
IF NVL(print_tax_code_text_, 'FALSE') = 'FALSE' THEN
Error_SYS.Appl_General(
lu_name_ => 'InvoiceCreation',
msg_name_ => 'INVOICENOTCREATED',
msg_value_ => 'Invoice was not created.'
);
END IF;
END;
Important: Error_SYS.Appl_General raises a standard IFS application error which will surface as a pop-up in the UI with your message text - exactly the behavior you want.