Any able to help me on this or have done something similar?
I have created a Data Directive BPM on PartTran.Update / Standard
It’s a very simple one but unfortunately the condition doesn’t seem to work correctly. I want it to fire off an email if ExtCost exceeds £1000 basically if the part they’re quantity adjusting cost goes over £1000 then fire an email to relevant people.
But it doesn’t seem to work, I’m getting quantity adjustment costs for £31, £12 -
I have chosen to write it in a LINQ statement but I can’t seem to get the OR section to work
Db.PartTran.Where(r =>r.Company == callContextClient.CurrentCompany && r.TranNum == ttPartTranRow.TranNum && r.ExtCost > 1000M).Select(r =>r.ExtCost ).DefaultIfEmpty(0).FirstOrDefault()
Data directive on PartTran feels like playing with fire… I would recommend a method directive on the Qty Adjust BO.
Are you able to show me an example of how to achieve this correctly?
Aaron - Did you mean for it to be negative 1000?
Turn on tracing, do the Qty Adjust, and then do the similar thing you did on the data directive, but with the method directive on the BO from the trace. We’ve got 2 for Inventory Qty Adjustments - One for sending an email when someone does a zero cost adjustment, and another to prevent future dates. The email had to have a condition triggered in the Pre to reduce false alarms, while the email is sent in the Post. Its similar, so maybe it’ll help.
What’s the criteria of your ds.InventoryQtyAdj
Both of the below are true:
31 > -1000
12 > -1000
Not sure what the minus is doing there. But if you want to check both positive and negative values you’ll need 2 conditions:
ttPartTran.ExtCost > 1000
ttPartTran.ExtCost < -1000
Is there anyway to get the ExtCost from SetInvQtyAdj?
Aaron - Not that I see within my BPM. What BO did your trace show? That should contain it. Or you could do Tim’s BPM to set that as a variable from a different table. I’m no C# coder, but it’s pretty straight forward:
I see a significant performance problem with the way you have the query assembled… you have linked the ds.inventoryQtyAdj table (which is not really a table but is a memory resident dataset) to a real dataset. The problem is that when SQL gets this, it doesnt run efficiently. Instead, you should get the data from the QtyAdj and put them into variables, and then FILTER PartTran’s criteria with those variables… see this rather large discussion: BPM SPEED Helpful Hint - be careful how you "Join"