0
votes

This my process screen: enter image description here as you can see it throws errors but it doesnt indicate the error mark on the grid. After clicking the process button, it just unchecks the checkbox in my records

i want the grid to be like this(with the red 'x' mark):

enter image description here

this is my graph :

public PXCancel<PayrollFilter> Cancel;

    public PXSetup<PayrollSetup> PayrollSetup;

    public PXFilter<PayrollFilter> Filter;

    [PXFilterable]
    public PXFilteredProcessingJoin<PayrollEmployeeProcess, PayrollFilter,
                                InnerJoin<EPEmployee,
                                    On<PayrollEmployee.employeeID, Equal<EPEmployee.bAccountID>>,
                                InnerJoin<Branch,
                                     On<EPEmployee.parentBAccountID, Equal<Branch.bAccountID>>>>,
                                Where<PayrollEmployee.payPeriodID, Equal<Current<PayrollFilter.payPeriodID>>,
                                And<Branch.branchID, Equal<Current<AccessInfo.branchID>>>>> EmployeePayrollProcess;



    #region Constructor
    public PayrollProcess()
    {
        PayrollSetup setup = PayrollSetup.Current;

        EmployeePayrollProcess.SetSelected<PayrollEmployeeProcess.selected>();

        EmployeePayrollProcess.SetProcessDelegate(delegate (List<PayrollEmployeeProcess> employees)
        {
            if (Filter.Current == null) return;

            var payPeriod = Filter.Current.PayPeriodID ?? 0;
            var payrollPeriod = Filter.Current.PayrollPeriodID ?? 0;

            if (payPeriod == 0 || payrollPeriod == 0) return;

            PXLongOperation.StartOperation(this, delegate ()
            {
                bool errorOccured = false;
                foreach (PayrollEmployeeProcess employee in employees)
                {

                    PayrollRegisterEntry graph = PXGraph.CreateInstance<PayrollRegisterEntry>();
                    try
                    {

                        graph.ProcessPayroll(employee, payPeriod, payrollPeriod);
                        PXProcessing<PayrollEmployeeProcess>.SetInfo("Employee processed");

                    }
                    catch (Exception ex)
                    {
                        errorOccured = true;
                        //employees.IndexOf(employee), 
                        PXProcessing<PayrollEmployeeProcess>.SetError(ex);
                    }
                    finally
                    {
                        graph.Clear();
                    }
                }
                if (errorOccured) throw new PXException("At least one employee was not processed.");
            });

        });
        // EmployeePayrollProcess.
    }`

can anyone can help me? I'm using Acumatica 6

1
There might be some BatchUpdate setting in the page and I typically see the processing of records on the process pages call a static method as the processing call which has helped resolve some issues for me in the past. - Brendan
should I use BatchUpdate on the grid settings? I already set the SyncPosition settings - Bienvenido Omosura
I always use release IN documents as my go to for an example in a processing page. (Page IN501000 / Graph INDocumentRelease). It uses BatchUpdate="true". Note that the process calls a static method called ReleaseDoc. Try to implement something similar. I have had issues with the objects being passed into the static call too. Its a little picky to get the processing icons to show, but use this graph as your example and you should be able to get it working - Brendan

1 Answers

1
votes

Throwing an exception in Acumatica sets the error in the header. To set a Row or Field level error you need to set/raise it. There's a few ways to set/raise errors, what they have in common is that they don't use the 'throw' keyword.

For a processing screen with a filter, use the following syntax to raise the error:

PXFilteredProcessing<GridDetailDAC, GridFilterDAC>.SetError(rowIndex, new PXSetPropertyException("Error Message", PXErrorLevel.RowError));

Processing screen without filter:

PXProcessing.SetError(rowIndex, new PXException("Error Message"));