Thanks so much for responding, I may be missing something obvious.
I've extended PurchTable to add a custom field, this field may be blank when the PO is created but must be populated for confirmation.
When confirming a single PO from "All purchase orders" screen, I click the "Confirm" button from the "Purchase" tab, the code below fires, this.purchTable() returns the selected line, the validation works.
But if I go to the "Confirm purchase order" screen, choose "Late selection", click "Select", this takes me to the "Purchase update" screen that allows me to provide a filtering query for the PO's I want to confirm. Click the "Ok" button, then click "Batch", then click "Ok", then click "Ok" again. At this point the validate fires, but this.purchTable() is a blank object with recId == 0, so I can't validate the records that may be included in the query nor do I want to at this point, there could be one, there could be hundreds. If I allow the validate to complete (debugging) I get a message stating "The Purchase order confirmation job is added to the batch queue.". The batch job runs and all PO's matching the filter criteria get confirmed, the validate method does not fire for each of them. I need to be sure my custom field is populated for each item before allowing it be confirmed.
[ExtensionOf(classstr(PurchFormLetter_PurchOrder))]
public final class PurchFormLetter_PurchOrder_My_Extension
{
public boolean validate(Object _calledFrom)
{
boolean ret = next validate(_calledFrom);
if (ret)
{
PurchTable purchTable = this.purchTable();
if(purchTable.MyCustomField == '')
{
ret = checkfailed("This needs to be populated.");
}
}
return ret;
}
}