Question

Make Compulsory / Required

  • 8 September 2021
  • 2 replies
  • 49 views

Badge

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
 

 


2 replies

Badge

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.

Userlevel 6
Badge +9

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();
}
}

 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved