Skip to main content
Question

Getting Error while adding new field in Sales order Screen


Hi,
I have been playing around the customization Project. I have added a new filed Excise Duty in the details tab of the Sales Order Screen SO30100. 
Now I want that Excise Duty to be 4% of the Quantity.  But I am getting error of


Below is my DAC and I have added code to calculate the Excise Duty

 

3 replies

Forum|alt.badge.img+6
  • Captain II
  • 550 replies
  • March 14, 2025

Two things:

First, you want SOLine.shippedQty and not SOLine.ShippedQty.

The other thing is that your two public declarations are int but your field type attribute is Decimal - you’ll want to pick one.


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 252 replies
  • March 14, 2025

@anupusefulbi I would also be interested in your definition of decimal0_04. I dont see this one of the system constants, wondering where/how you have defined it.


harutyungevorgyan
Jr Varsity I

Hello ​@anupusefulbi ​,
 

The responses from ​@Django  and ​@RohitRattan88 are correct but I’d like to offer some additional insights to help you move forward.

If you are not a developer or are just starting your development journey, Acumatica provides built-in functionality to create fields with the correct attributes and structure, reducing the risk of typos. You can use any package for that feature to automatically generate fields. To do this, navigate to any package in the Data Access section and create a new field. This will generate all the necessary attributes for the field. Once you publish the package, you can find the generated class in the App_Runtime folder within your instance. Exploring this class will help you understand the structure Acumatica uses to define fields.

Regarding decimal0_04, there is no predefined constant for this value in the libraries you are using. While you can use GlobalUsing to include relevant namespaces where this class is already created, if that’s not an option in your case, you can define a constant class manually. Here’s how you can do it:

public class decimal0_04 : BqlDecimal.Constant<decimal0_04> 
{ 
  public decimal0_04() : base(0.04m) { } 
}

 

You can create multiple constants following this pattern by changing the class name and base value. Ensure that you add PX.Data.BQL to your using statements.

If you have placed this class inside a file named MyConstants.cs, you can use it in a formula like this:

[PXFormula(typeof(Mult<SOLine.shippedQty, MyConstants.decimal0_04>))]

I hope this helps! Let me know if you have any further questions.


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