Question

Making field required at graph level

  • 15 June 2023
  • 2 replies
  • 151 views

Hi I am stuck at a very basic requirement, where i have to make this field required at screen level. Below is Original attributes for that field.

Field Name : ExpirationDate

Data Class : PX.Objects.CR.CRQuote

Original Attributes:

     [PXDBDate(BqlField = typeof(Standalone.CRQuote.expirationDate))]
[PXMassUpdatableField]
[PXUIField(DisplayName = "Expiration Date", Visibility = PXUIVisibility.SelectorVisible)]

I tried this by using CustomAttribute for both Required and Default :

 [PXMergeAttributes(Method = MergeMethod.Append)]
[PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), "Required", true)]
protected virtual void CRQuote_ExpirationDate_CacheAttached(PXCache cache){}

and

    [PXMergeAttributes(Method = MergeMethod.Append)]
[PXDefault(PersistingCheck = PXPersistingCheck.NullOrBlank)]
protected virtual void CRQuote_ExpirationDate_CacheAttached(PXCache cache)
{

}

but still the form is allowing blank values. Please note field is a datetime type.

Please help


2 replies

Userlevel 5
Badge +1

Hi Amit,

here is my code, after build the Expiration Date is Required. I think that you have issue with MergeMethod.Append, because I use Method = MergeMethod.Merge

Try method Merge, I hope it will work on your side.

 

 

Userlevel 7
Badge +10

Hi @amitr70 

As @andriikravetskyi35 mentioned, you can use the same method. Additionally, you can also add it directly by using the editor. In Layout Properties, set Required to True and publish the customization.

Regards,

Sweta

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 — 2024  Acumatica, Inc. All rights reserved