Skip to main content

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 @pandachan48   As suggested by @markusray17 It requires a small piece of customization.

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?

 

e2024-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?)
e2024-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?)

Reply