Scheduled process return

╄→尐↘猪︶ㄣ 提交于 2019-12-11 14:05:09

问题


I have scheduled a ProcessAll action. I have a

throw new PXOperationCompletedException(statusText);

at the end of the routine if there are no errors during the process. However, this causes the schedule to show with a red X icon on the Automation Schedules screen. Commenting out the exception allows the schedule to show a green check mark, but then the status text is not returned nor does it show on the regular process page when hovering over the check mark at the top of the screen. Is there another PXOperationCompleted variation to handle this?


回答1:


This seems to be a potential issue on the Acumatica side. Throwing PXOperationCompletedException should not result in error status shown on the Automation Schedules screen.

To answer your question, throwing PXOperationCompletedException at the end of a background operation is currently the only supported option to show a custom message for a successfully completed process.

I have sent all details to Acumatica engineering Team for review. Hopefully, the fix will be released soon in one of the upcoming updates.




回答2:


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<DAC> dacRecords)
{
    int rowIndex = 0;
    bool isError = false;

    foreach (DAC dacRecord in dacRecords)
    {
        PXProcessing<DAC>.SetCurrentItem(dacRecord);

        try
        {
            // Set Error Message
            PXProcessing<DAC>.SetError(rowIndex, new PXException("Error Message"));

            // Set Warning Message
            PXProcessing<DAC>.SetWarning(rowIndex, new PXException("Warning Message"));

            // Set Info Message (green check mark)
            PXProcessing<DAC>.SetInfo(rowIndex, "The record has been processed successfully.");  
        }
        catch (Exception ex)
        {
            PXProcessing<DAC>.SetError(rowIndex, new PXException(ex.ToString()));
            isError = true;
        }

        rowIndex++;
    }

    if (isError)
    {
        throw new PXOperationCompletedWithErrorException();
    }
    else
    {                
        PXProcessing<DAC>.SetProcessed()      
    }
}


来源:https://stackoverflow.com/questions/48428320/scheduled-process-return

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!