In Purchase Order Entry, Epicor automatically sets the ReadyToPrint checkbox to true when the PO is changed from unapproved to approved. I’m trying to prevent this from happening or atleast set the ReadyToPrint checkbox to false after it automatically changes to true.
To achieve this I’ve tried using a method directive on the PO.ChangeApproveSwitch method, both pre- and post-processing. I also tried it with a data directive on POHeader, both standard and intransaction. I’ve tried changing it in the ttPOHeader and also directly in the Db.POHeader.
After having no luck with the BPM approach i tried it in a customization of the PO Entry. After the Update method, which is the last method from the POAdapter that gets called when switching the Approve checkbox, I tried to set the ReadyToPrint field from the POHeader EpiDataView, with no luck either.
Am I missing something, or is Epicor overwriting the changes I make on the ReadyToPrint field?
Example code (Method directive - PO.ChangeApproveSwitch):
Execution after condition: ApproveValue variable is True
using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
foreach (var ttPOHead in (from ttPOHead_Row in ttPOHeader
where ttPOHead_Row.Company == Session.CompanyID
select ttPOHead_Row))
{
foreach (var poHead in (from poHead_Row in Db.POHeader
where poHead_Row.Company == ttPOHead.Company &&
poHead_Row.PONum == ttPOHead.PONum
select poHead_Row))
{
//this.PublishInfoMessage(poHead.ReadyToPrint.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
//ttPOHead.RowMod = "U";
ttPOHead.ReadyToPrint = false;
poHead.ReadyToPrint = false;
}
}
Db.Validate();
txscope.Complete();
}