I have scheduled a ProcessAll action. I have a
throw new PXOperationCompletedException(statusText);
at the end of the routine if there are no
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.
The PXProcessing class contains the following static methods:
.
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()
}
}