How to make it compulsory / Required when user create customer account, I want to make it cannot save if the line is empty.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/ae84cb6b-36df-4523-9841-fe41f154370d.png)
and Also how to make the column compulsory / Required in SO line
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/74f97789-fc2d-41ce-92f4-1983969d2971.png)
How to make it compulsory / Required when user create customer account, I want to make it cannot save if the line is empty.
and Also how to make the column compulsory / Required in SO line
This would be a customization.
You can use an event handler for RowPersisting to check if there is at least one salesperson listed and throw an error if their is not.
[PXDefault(typeof(SOOrder.salesPersonID), PersistingCheck = PXPersistingCheck.Nothing)]
For the SOLine you can just modify the PXDefault Attribute to set the PXPersitingCheck to NullOrBlank which will make it a required field.
Hi
Please find the code below.
// Sales Orders screen Customization
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
#region SalesPersonID
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(PXDefaultAttribute))]
[PXDefault(typeof(SOOrder.salesPersonID), PersistingCheck = PXPersistingCheck.NullOrBlank)]
protected virtual void SOLine_SalesPersonID_CacheAttached(PXCache cache)
{
}
#endregion
}
// Customers screen Customization
public class CustomerMaintExt : PXGraphExtension<CustomerMaint>
{
public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate del)
{
if (Base.SalesPersons.Select().FirstTableItems.ToList().Count == 0)
{
throw new PXException("Salesperson info not found");
}
del();
}
}
I tried using this and got the following error. Should work for 2023r2?
[2024-02-03 20:44:58.989] \App_RuntimeCode\salesperson01.cs(6): error CS0246: The type or namespace name 'CustomerMaint' could not be found (are you missing a using directive or an assembly reference?)
[2024-02-03 20:44:58.989] \App_RuntimeCode\salesperson01.cs(6): error CS0246: The type or namespace name 'CustomerMaint' could not be found (are you missing a using directive or an assembly reference?)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.