Working on a BPM and had some help earlier but seems to have diminished as it is bedtime here on the East Coast. I am hoping there are some on the West Coast still up that might help me out. In the picture below you can see on the left there is a temp table section and a ds section. The code shown works on the temp table section and I am wanting to get it working for the ds table section. My interpretation is that there is a difference in the ds tables and temp tables. I am looking for some help to get the highest value in the orderline field so that it only returns one record. When entering orders in through DMT I am able to get the bpm to fire but returns a null reference. I am guessing (hoping) using the ds tables there will not be null values.
Anyway thanks in advance as I have been working on this BPM for days and have to deliver this coming Monday but concerned I have run out of time. Willing to get help for whatever it takes as I am in dire need.
Well I got it to work but still got the same results of null reference when using DMT so still on the path of figuring out why DMT throws a null exception but works fine just adding a new line through epicor.
The syntax was
ds.OrderDtl.OrderByDescending(dtl => dtl.OrderLine).FirstOrDefault()?.OrderLine ?? 0
Can you give some more context on what you’re trying to do with the BPM? Also, What method is this firing on?
Our company is wanting a misc charge to automatically be applied to sales orders. The catch is it will only be for certain customers and certain parts so based on my interpretation we will need a BPM that adds at the line level.
Well after 2 weeks I have a BPM that does just that if you enter through Epicor. We also have 3 other avenues an order can be entered. Through Service Connect, Through DMT, Through EDI. So we have to cover all. The BPM works from Epicor as well on Service Connect but throws an error on DMT saying record not found in table and EDI doesn’t even know the BPM is there. So end goal is find a BPM that will work for all. I wish there was a way to just grab the record that was just updated in a Data Directive and then pass to a Method directive where we can use the BO methods. Our BPM is on the SalesOrder.Update method. I have attached an export of the BPMs as they are now so you can import and see. These are on version 10.2.400
I am willing to pay anyone to help get this done as this Monday is the deadline. t r y g . t h a y e r @ t a r t e r u s a . c o m
Surcharge_Rev1.bpm (263 KB)
The UpdateExt method might work with The other entry methods. Leave the one on Update active since it’s working. UpdateExt fires on on updatable BAQs and I believe DMT. Not sure about service connect and edi but it’s worth a shot.
You can make method/adapter calls from within a data directive via C# code. Can’t give a complete rundown on it now, but you can find plenty of examples in this community.
Linq has a Max() function LINQ Max
What BO, method and type (pre/post) is it that works on the UI, but not in DMT?
Also, does this only need to happen when the line is created? Or should it add the Misc Charge if a line meeting the conditions is changed, and currently doesnt have the Misc Charge?
And why do you need the “last” linenum?
And beware, the highest line num may actually be a component of a sales kit. So might want to test for that.
Ouch. Thanks for the heads up. The component item certainly would be a problem.
And why aren’t you adding the Misc Charge to the line with the matching part num(s), instead adding it to the last line?
And why couldn’t it be a header Misc Charge?
I know one! I did a post-proc on salesorder.update and it would never fire on DMT or service connect orders. In the end I had to use master update with some criteria instead.
IT could not be a header misc charge as there are specific parts that are to be excluded.
Does each of the matching parts need to have its own Misc Charge? And must the Misc Charge be tied to the line (so the charge only happens when that line ships)?