One of my top 8 Oracle Applications (eBiz) developer hooks is workflow.
Most commonly workflow is used for Approvals and Account Generators.
The Account Generators are very specific little critters with a couple of subtleties, one of which is how they pass back error messages to the user. It ain't hard, just a straightforward 1-2-3 procedure.
- Set the Error Message node attribute of the "Abort Generating Code Combination" item attribute "Error Message"
- Ensure the workflow goes to "Abort Generating Code Combination" when an error occurs in your custom code
- Make sure your code calls FND_MESSAGE and sets the ERROR_MESSAGE item attribute (internal identifier) to fnd_message.get_encoded
Lets do it for the Purchase Order (PO) Account Generator POWFPOAG, process Generate Default Charge Account.
1. Abort Generating Code Combination Error Message attribute.

- Open up the PO Account Generator in Workflow Builder
- Navigate to and open process "Generate Default Charge Account".
- Find and right click to get properties of "Abort Generating Code Combination" after the flow from Generate Default Expense AccountClick the Node Attributes tab
- Select Error Message from the Name dropdown
- Choose Type Item Attribute
- Choose Value "Error Message". NB: This is not in alphabetical order.
- Save
2. and 3. Code the "Failure" and set the message in your custom code.
In your custom procedure that generates the account, ensure you have code that looks something like the following code. Note we "borrow" the existing generic FND message ERROR_MESSAGE to save having to create a new message and generate message files. Also note that in this specific example we are generating the account based on some component of the Employee's default expense account, which if not setup correctly will set success = 'N'. Of course your logic will be different here, and I don't recommend multiple returns in a function, but this code is presented for simplicity.
if (success = 'N') then FND_MESSAGE.set_name('FND', 'ERROR_MESSAGE'); FND_MESSAGE.set_token('MESSAGE', 'The PO Account Generator failed to generate the default account. ' || 'Please ask your System Administrator to check your ' || 'Employee Default Expense Account is setup correctly.'); wf_engine.SetItemAttrText ( itemtype=> itemtype, itemkey => itemkey, aname => 'ERROR_MESSAGE', avalue => fnd_message.get_encoded); result := 'COMPLETE:FAILURE'; return; end if;
All done, test it out! You should see something like the second screenshot when you hit an error.

PS. Persistence and Account Generators showing in Status Monitor
As a side note account generators persistence is "temporary" and also they don't appear under the Status Monitor in Workflow Administrator unless you switch a couple of debug profile options to Yes:
- PO: Set Debug Workflow ON
- Account Generator:Run in Debug Mode
PPS. Show workflows to all users with Workflow Admininstrator
For development and test environments, the following may come in handy to enable ALL users with access to Workflow Administrator Status Monitor to see ALL permanent workflows.
prompt Remember what the value was so we can set it back if needed. select text from wf_resources where name = 'WF_ADMIN_ROLE'; TEXT -------------------------------------------------------------------------------- SYSADMIN update wf_resources set text = '*' where name = 'WF_ADMIN_ROLE'; 1 row updated. commit;
Happy Account Generating!