Skip to main content
Solved

Making field required at graph level


amitr70
Semi-Pro I
Forum|alt.badge.img

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

Best answer by andriikravetskyi35

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.

 

 

View original
Did this topic help you find an answer to your question?

2 replies

andriikravetskyi35
Jr Varsity I
Forum|alt.badge.img+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.

 

 


Forum|alt.badge.img+9
  • Semi-Pro III
  • 229 replies
  • June 16, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings