Search code examples
acumatica

How can I filter records for the Generate Recurring Entries (GL504000) screen


I'm trying to modify the Generate Recurring Transactions (GL504000) screen, and I want to add a user field to filter the grid. I've added a UsrRecurringClass user field to DAC extensions of both the 'Parameters' DAC for the header, and the 'Schedule' DAC for the grid. Now I want to filter that grid by the selection I've added to the header (The UsrRecurringClass field I've added to both)

The problem is, I can't add that field to the View select (Schedule_List) and have it make any difference (I did set the CommitChanges to true on the header filter field).

I've added this to graph extension of the 'ScheduleRun' BLC, as follows, but it doesn't seem to make any difference...

[PXFilterable]
public PXFilteredProcessing<Schedule, ScheduleRun.Parameters,
      Where2<Where<ParametersExt.usrRecurringClass, IsNull, Or<ScheduleExt.usrRecurringClass, Equal<Current<ParametersExt.usrRecurringClass>>>>,
                   And2<Where<Schedule.active, Equal<True>>,
                   And<Schedule.nextRunDate, LessEqual<Current<ScheduleRun.Parameters.executionDate>>>>>> Schedule_List;

Maybe I'm not doing the BQL correctly, or there's a better way, using the View delegate - I'm not sure.

Any ideas?


Solution

  • I have done a similar customization, maybe the pattern will help you.

      public class ARCreateWriteOff_Extension : PXGraphExtension<ARCreateWriteOff>
        {
            #region Event Handlers
    
            // First expose the PXFilterable view in the extension 
            [PXFilterable]
            [PX.SM.PXViewDetailsButton(typeof(ARRegisterEx.refNbr), WindowMode = PXRedirectHelper.WindowMode.NewWindow)]
            public PXFilteredProcessingJoin<ARRegisterEx>  ARDocumentList;
            // the ARDocumentList view is a long BQL statement I just removed most of it for the example
    
    
            // Over write the IEnumerabel 
            protected virtual IEnumerable aRDocumentList()
            {
                // Get the current row and its extention
                ARWriteOffFilter aRWriteOffFilter = Base.Filter.Current;
                ARWriteOffFilterExt aRWriteOffFilterExt = aRWriteOffFilter.GetExtension<ARWriteOffFilterExt>();
                // loop the values
                foreach (ARRegisterEx item in Base.ARDocumentList.Select())
                {
                    //check if the field is Null to return all data
                    if (string.IsNullOrWhiteSpace(aRWriteOffFilterExt.UsrEmployeeID))
                    {
                        yield return item;
                    }
                    else
                    {
                        
                        // Here you will check if your filter matches the row level
                        if (aRWriteOffFilterExt.UsrEmployeeID == bAccountExt.UsrEmployeeID)
                        {
                            yield return item;
                        }
                    }
    
    
                }
    
            }