Method Directive not honoring new value

I have a method directive on SalesOrder.Update and am running into a real bugger of an issue which I think should be easy.

Customer service would like a pop-up box if they add a SO line and the parts have certain header analysis codes. They want to be warned that they added a subassembly and not a top level assembly due to customer part number confusion.

I can get this to work on a NEW line but on an updated line the BPM is not working correctly. My BPM checks for two Analysis codes in a query and should return more than one line if either of those codes is assigned.

If I change the part number from any part to a subassembly it sends a popup
If I change the part number from a part NOT a subassembly to one that is NOT a subassembly it does not send a popup.
If I change the part number from a part that is a subassembly to one that is NOT a subassembly it sends a popup and that is wrong.

The Query seems to be looking at what it was and what it becomes at the same time. I tried adding OrderDtl where Company=Company, OrderNum=OrderNum, OrderLine=OrderLine and added criteria on ttOrderDtl whereSysrowID<>OrderDtl.SysrowID and get an infinite wheel of death when saving.

How many Parts do you have?

1 Like

Try setting a table criteria on the ttOrderDtl table in the Query where RowMod == “U” or RowMod == “A”. I believe method directives are passed an unmodified row and the modified row for the pre and post comparisons, so your query sees both the original row and the updated row and passes.

Also your Part is the first table and ttOrder is 2nd, change the order.

2 Likes

Thank you the BPM Speed article was the solution. Amazing and I’ll use that from now on. If I had only seen that 3 years ago! It would have simplified things quite a bit.