Solved

Custom Field Value Not Populating in Generic Inquiry

  • 29 October 2023
  • 1 reply
  • 79 views

Userlevel 5
Badge +1

Hi Team,

I've added a custom field named "UsrContractAmount" to our project. This field is designed to calculate a value based on certain criteria.

Below is the code related to this field:

 

#region UsrContractAmount
    [PXDBDecimal]
    [PXUIField(DisplayName="Contract Amount", Enabled = false)]

    public virtual Decimal? UsrContractAmount { get; set; }
    public abstract class usrContractAmount : PX.Data.BQL.BqlDecimal.Field<usrContractAmount> { }
#endregion
 

The calculation for this field is performed in the following method:

 

protected virtual void _(Events.RowSelected<PMProject> e) { var row = (PMProject)e.Row; var rowExt = PXCache<PMProject>.GetExtension<PMProjectExt>(row); PMProject project = e.Row; const int targetAccountGroupID = 35; const string targetGroupCD = "REVREC"; decimal sumContractAmount = 0; if (getBudgetLines == null) return; // Retrieve all the PMRevenueBudget records for the specific groupCD. foreach (PMRevenueBudget costBudget in PXSelectJoin<PMRevenueBudget, InnerJoin<PMAccountGroup, On<PMRevenueBudget.accountGroupID, Equal<PMAccountGroup.groupID>>>, Where<PMAccountGroup.groupCD, Equal<Required<PMAccountGroup.groupCD>>>> .Select(Base, targetGroupCD)) { // Check if the accountGroupID matches the target value (35). if (costBudget.AccountGroupID == targetAccountGroupID && costBudget.ProjectID == project.ContractID) { sumContractAmount += costBudget.CuryRevisedAmount ?? 0m; } }

 

However, I've encountered an issue where, upon adding this field to a generic inquiry in my project, the field value is not populating for all projects. It seems to be working only for certain generic inquiries.

In the project screen, the field is functioning correctly, but it is not working in the Generic Inquiry.

I would greatly appreciate any assistance or insights you can provide to help resolve this issue.

Best regards,

Sagar

icon

Best answer by aaghaei 29 October 2023, 17:45

View original

1 reply

Userlevel 7
Badge +8

@sagar07 The same goes here similar to my reply to your previous post. If you are updating a parent from child, you will need to:

  • Either loop on the associated child records and update the parent that can happen on the parent RowUpdated or RowPersisted event or Persist method.
  • Or you can utilize Acumatica’s SumCalc function of PXFormula attribute on the child field (it will work only if one field of all child records making up the parent record desired field) to track the child record changes and update the header instantly.

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