Hello community,
I would like to make a field of Int Data Type to not accept negative values. I would like to know if I can define the logics using the Customization project Editor? If not then using VS how shall I load up the file in which i am willing to apply the condition for the particular field?
Thanks in Advance.
Negative Values
Best answer by harutyungevorgyan
HelloĀ
Using the Customization Project Editor:
- Open your Customization Project.
- Navigate to the DAC that contains the field you want to modify.
- Select the field, and in the field properties, add a PXInt attribute with a MinValue parameter.
- In the MinValue parameter, set the minimum value to 0.
- Publish the customization.
Here's an example:
Ā
[PXInt(MinValue = 0)]
[PXUIField(DisplayName = "Custom Field")]
public virtual int? UsrCustomField { get; set; }
public abstract class usrCustomField : PX.Data.BQL.BqlInt.Field<usrCustomField> { } Using Visual Studio:
- Open your customization project in Visual Studio.
- Navigate to the DAC that contains the field you want to modify.
- Add or modify the attribute for the field, setting the MinValue parameter of the PXInt attribute to 0.
- Save the file and publish the customization from the Customization Project Editor in Acumatica.
After applying the customization, the field should no longer accept negative values. When a user tries to input a negative value, they should receive a validation error.
Thank you so muchĀ
Ā

And upon creating a new field and adding the lines as you suggested, theĀ system displays the following message when trying to publish as shown below. Please let me know what IĀ am missing here. I havenāt created any field with name as Custom2 before.
Ā

Thanks in advance.
Hi
Ā

Ā
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.