Search code examples
c#acumatica

Acuamtica Cases additional grid not displaying all PXSelect related data rows from Relations grid


Using the Acumatica code below, I was able to conditionally create a new grid in the Cases screen; however, the PXSelect command is not displaying all of the rows in grid. What I am trying to do is based on the "Relations" take the value of CRRelation.targetNoteID and pull all of the ARRegister data into a new grid called "CAM Info". But the "CAM Info" graph view is only displaying the very first row from "Relations" and not all the other ones. (See the screen shot images for reference) How do I need to write the Acumatica code to find, select and display ALL of the rows in the "CAM Info" grid?

using System.Collections.Specialized;
using System.Linq;
using PX.Common;
using PX.Data;
using System.Collections;
using PX.Data.EP;
using PX.Objects.AR;
using PX.Objects.CT;
using PX.Objects.CR.Workflows;
using PX.Objects.GL;
using PX.Objects.EP;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.SM;
using PX.TM;
using PX.Objects;
using PX.Objects.CR;
using System.Net.Http;
using System.Collections.Generic;
using System.Collections;

namespace PX.Objects.CR
{

  public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
  {     
      
     
    #region Event Handlers
        protected virtual void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
          {
            InvokeBaseHandler?.Invoke(cache, e);
            var row = (CRCase)e.Row;
            if (row != null)
              {
                if (row.CaseClassID == "CAM")
                  {
                    PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrRMAReason>(cache, row, false);
                    PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrSupportCategory >(cache, row, false);
                    PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrContractDesc>(cache, row, false);
                    PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrCaseStage>(cache, row, false);
                    PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrIGAHEquipmentID>(cache, row, false);                 
                  }
                

              } 
            
          } 
  
    #endregion
               
        
    // Following view delaration populates the ARRegister info; but only one line            
    #region Selects  
       public PXSelect<ARRegister, Where<ARRegister.noteID, Equal<CurrentValue<CRRelation.targetNoteID>>>> CAMRelationsView;
    #endregion
             
 
      
  }
}```
[![Cases Relations Tab grid][1]][1]
[![Cases CAM Info Tab grid][2]][2]


  [1]: https://i.sstatic.net/m4KA0.jpg
  [2]: https://i.sstatic.net/CBYNQ.jpg

Solution

  • Declare view is incorrect. You need to declare it like this

    public PXSelect<ARRegister, Where<ARRegister.noteID, Equal<Current<CRRelation.targetNoteID>>>> CAMRelationsView; 
    

    Also, you need to set 2 more settings

    1. SyncPosition for the Relation grid should be set to true
    2. on the AutoCallBack events you need to write a dynamic update for your own grid view with grid ID.

    Current<Field> - Inserts the field value from the Current property of the cache. If the Current property is null or the field value is null, the parameter will be replaced by the default value.
    CurrentValue<Field> - Equivalent to the Current parameter, but is used in the PXProjection attribute.
    Display all ARRegister. It depends on what record you will enter on the Relation tab.

    1. If it will be a Customer record you can select all ARRegister for that customer
    2. if it will be an ARRegister record you can select all related transactions In case ARRegister is a payment you can select all applied invoices if ARRegister is an invoice you can select all applied payments