PO Approval BPM Broken after upgrade to 10.2.200.9

I created a BPM for our company that would send an e-mail to the appropriate approval person based on dollar amount back in Vantage 8.03 that has worked in Epicor 9 and Epicor 10.1, but is now broken in 10.2 and I can’t find a fix.

I added a Post-Processing Directive to PO.ChangeApproveSwitch that had code that found the appropriate approval person based on the dollar amount of the PO when the ApprovalStatus field was set to ‘P’. Then when the PO.Update was called, the e-mail would send to the approval person.

It seems that with 10.2, a method was added called ChangedApproveSwitch that now handles setting the ApprovalStatus to ‘P’. The order of methods is now ChangeApproveSwitch, CheckBeforeUpdate, Update, and ChangedApproveSwitch. A trace shows that the ApprovalStatus field stays set to ‘U’ through the first 3 methods listed, and then gets set at ChangedApproveSwitch. I moved my code to that method which worked, however, I created an e-mail template with the Send E-mail icon in the BPM Workflow Designer and added fields with the Field Query option so the approval person would have some information on the PO. The e-mail sent, but the fields were blank almost like this method didn’t have access to the full dataset.

I’ve seen other examples in the forum will people had their BPM’s tied only to the Update method. Based on what I’m seeing in the trace that ApprovalStatus does not get set until after the Update method, I don’t think that is an option. If you upgraded to 10.2.200, did your BPM’s stop working also? If not, how are yours built? Do I need to send the e-mail via code so I have access to the data that I want in the e-mail?

Any guidance is appreciated. Thanks.

I use a Standard Data Directive on the POApvMsg table. This just grabs the to and from users and emails them the new status of the PO by monitoring the MsgType. I built one going up the chain and one going down the chain.

Edit: MsgType 1 is going up the chain. MsgType 2 is going down the chain. Then I just include the response from the table and a little bit of Linq to query the email/supplier.

3 Likes

If there is data you want that isnt passed to the dataset, you could always use a widget with a GetByID using the ID from the passed head. Store these results in a variable, then access them in your email template

Btw - a widget is one of those little tools in your toolbox in the BPM editor. You’ll want the Invoke BO method one. Select the proper BO, select the GetByID method, pass it the ID from your ttRecord

2 Likes

I have the same problem. It used to work on 10.0 but now there is no “P” on the ApprovalStatus field anymore so my BPM on the ChangeApproveSwitch Post Process no longer sends the email (no longer triggers). I am going to try the widget if I can figure it out.

Travis,
So your BPM sends the email out but with empty fields? I can’t even trigger mine to send out. Would you be able to share your code and maybe it will resolve my issue? Thanks.

Mine stopped working also. No help from support, they suggested a Data directive as Dan did.

Jeffrey,

I did get mine working. I’ll put together the code and some screen shots of the widgets used and send it later this week.

2 Likes

Here is a write up on the BPM. I have code for a multi-approver setup if needed.

PO_Approval_BPM.docx (197.3 KB)

3 Likes

Thanks Travis. I will try this code and let you know if it works for me.

Travis, is this code E9? 10.1 does not have ttPOHeader.Shortchar02 (or any ShortChar fields).

Thanks.

It is for E10. ttPOheader.ShortChar02 is apart of my dataset for POHeader since it had data in it during the transition from E9 to E10. You can add ShortChar02 in UD Table Maintenance, or you can create your own UD Field and update the code and e-mail widget with that UD Field.

1 Like

Travis,

It does not work for me. Unfortunately, there is no “P” when the method runs so the BPM does not trigger. I already reported this to Epicor and hopefully they will have an answer. One last thing, I just need to confirm if it’s also happening on your side, can you run a trace log on when the Approve checkbox is checked? then look at all the ApprovalStatus fields on all method and see which method is using to set the ApprovalStatus to “P”. I would appreciate it. Thanks.

The POHeader.Approve fields changes from False to True during the ChangeApproveSwitch method, but the ApprovalStatus field is still set to ‘U’. The ApprovalStatus doesn’t get changed to ‘P’ until the ChangedApproveSwitch gets called after the Update method according to the trace I’ve done.

Does the shape beside the checkbox in the UI change to yellow with ‘Pending’ in the shape?

Yes, the shape beside the checkbox does change to Pending. According to my trace, the ApprovalStatus always stays at “U” even after the Update method. Do you think you can send me your trace log file for comparison?

Here is my trace.

POApprovalTrace.txt (250.4 KB)

Here is an example I’ve built onto POApvMsg.
Please ignore the first condition as it just ignores a certain group.

Erp.Tables.PurAgent PurAgent;
Erp.Tables.POHeader POHeader;
Erp.Tables.Vendor Vendor;
var ttPOApvMsg_xRow=(from ttPOApvMsg_Row in ttPOApvMsg
where string.Compare(ttPOApvMsg_Row.RowMod ,“U” ,true)==0|| string.Compare(ttPOApvMsg_Row.RowMod ,“A”
,true)==0 select ttPOApvMsg_Row).FirstOrDefault();
string AppPerson = string.Empty;
string VendorName = string.Empty;
int VendorNum = 0;
string EntryPerson = string.Empty;
if(ttPOApvMsg_xRow != null)
{
PurAgent =(from PurAgent_Row in Db.PurAgent
where PurAgent_Row.Company == Session.CompanyID && string.Compare(PurAgent_Row.BuyerID,ttPOApvMsg_xRow.MsgTo,true)== 0
select PurAgent_Row).FirstOrDefault();

  AppPerson = PurAgent.EMailAddress;

  POHeader =(from POHeader_Row in Db.POHeader
  where POHeader_Row.Company == Session.CompanyID && POHeader_Row.PONum == ttPOApvMsg_xRow.PONum
  select POHeader_Row).FirstOrDefault();

  VendorNum = POHeader.VendorNum;

  Vendor =(from Vendor_Row in Db.Vendor
  where Vendor_Row.Company == Session.CompanyID && Vendor_Row.VendorNum == VendorNum
  select Vendor_Row).FirstOrDefault();

  	VendorName = Vendor.Name;
  
  EntryPerson = POHeader.EntryPerson;

  if(PurAgent != null && POHeader != null){
     callContextBpmData.Character01 = AppPerson;	
     callContextBpmData.Character02 = VendorName;	
     callContextBpmData.Character03 = EntryPerson;
  	}
}

We have messages sending to the original user when the PO gets its final approval. It uses the same custom code but with the condition being “2” instead of “1”

2 Likes

I am running Epicor 10.1.400.20 the only value for ApprovalStatus is “U” for unapproved PO and “A” for approved onse, so without looking to your way of constructing your BPM, if i were you i will go around the “P” value problem, by changing the “P” condition to be ApprovalStatus field equal “A” on post-process ChangeAprroveSwitch method, and that is it.


you can try this simple modification

Yes you are correct. ApprovalStatus on 10.1 seems to be stucked at “U”. hmmm… I will try your suggestion and let you know.

Thanks Dan. this looks like this is on the final approval and I have this already working on the ttPOApvMsg method. I am needing help on the ChangeApproveSwitch to notify the approval person.