Scheduled process return

前端 未结 2 868
梦谈多话
梦谈多话 2021-01-28 01:24

I have scheduled a ProcessAll action. I have a

throw new PXOperationCompletedException(statusText);

at the end of the routine if there are no

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-28 02:22

    The PXProcessing class contains the following static methods:

    • PXProcessing.SetCurrentItem - Set the current processed item
    • PXProcessing.SetError - Set an error message
    • PXProcessing.SetWarning - Set a warning message
    • PXProcessing.SetInfo - Set the info message (green check mark)
    • PXProcessing.SetProcessed - Set a success flag

    .

    public static void ProcessDelegate(List dacRecords)
    {
        int rowIndex = 0;
        bool isError = false;
    
        foreach (DAC dacRecord in dacRecords)
        {
            PXProcessing.SetCurrentItem(dacRecord);
    
            try
            {
                // Set Error Message
                PXProcessing.SetError(rowIndex, new PXException("Error Message"));
    
                // Set Warning Message
                PXProcessing.SetWarning(rowIndex, new PXException("Warning Message"));
    
                // Set Info Message (green check mark)
                PXProcessing.SetInfo(rowIndex, "The record has been processed successfully.");  
            }
            catch (Exception ex)
            {
                PXProcessing.SetError(rowIndex, new PXException(ex.ToString()));
                isError = true;
            }
    
            rowIndex++;
        }
    
        if (isError)
        {
            throw new PXOperationCompletedWithErrorException();
        }
        else
        {                
            PXProcessing.SetProcessed()      
        }
    }
    

提交回复
热议问题