How to notify about errors on Processing screens that are made through Automation schedules

Hello everybody,

today I want to leave a short notice on how to send a message from your graph for cases, when your graph is used in processing screen which is implemented through Automation steps. For this purpose you can use new property of PXAdapter class. It has property 

MassProcess. In case if your graph will be executed from processing screen that property will be set to true. Then you'll get a chance to notify processing screen about error with help of SetError message. In that case in your graph you can write something like this:

var currentSoOrder = currentSoOrderBoxed.GetItem<SOOrder>();
string errorMessage = string.Format(WorkFlowMessages.creditLimitExceededTemplate, currentSoOrder.OrderNbr);
try
 {
  ShipmentsTermsValidator.ValidateShipment(Base, currentSoOrder.CustomerID,
                    currentSoOrder.CuryUnpaidBalance, errorMessage, ShipmentsTermsValidator.ShipmentValidation.ShipmentConfirmation);
  }
  catch (Exception e)
  {
     if (adapter.MassProcess)
     {
          PXProcessing<SOShipment>.SetError(e);
     }
     throw e;
  }

In this way you can notify your processing screen.

No Comments

Add a Comment