I am trying to make the Description field on the Journal Transactions screen required, but only if the entry is being created on the Journal Transactions screen. I don’t want to stop sub ledgers from posting entries if no description is provided. For example, if someone creates a payables invoice without a description, I don’t want to cause the transaction to not post to the GL if the payables transaction does not have a description.
I added the red asterisk to the field. Obviously, that doesn’t make the field required, but just shows that it is required.
Here is the event I am firing to try to make this happen:
public class JournalEntry_Extension : PXGraphExtension<JournalEntry>
{
protected void _RowUpdating(Events.RowUpdating<Batch> e)
{
var row = (Batch)e.Row;
if (row == null) return;
if (row.Module == “GL”)
{
if (row.Description == null)
{
//throw new PXSetPropertyException(ICInterTenant.Messages.DescriptionIsRequired);
//throw new PXException(ICInterTenant.Messages.DescriptionIsRequired);
throw new Exception(ICInterTenant.Messages.DescriptionIsRequired);
}
}
}
}
When I debug this, if the entry is coming from the Journal Transactions screen, it fires and the Exception is raised in the code. However, you can still save the entry and no messages appear on the screen.
What am I doing wrong?
Thanks in advance for all your help!
Joe