Simple Data Directive Not Firing Consistently

I have an in transaction data directive setup on the OrderHed table that is running the code below to pull back some email addresses we have saved in a UD field on Customer. The problem is that this will work for some customers when creating orders but not all and I haven’t been able to find a pattern. I’ve tried moving this to a method directive and it still does not work. My end goal (which I do have setup) is to have a routing rule on the pack slip print that emails out an additional report without user interaction.

I have tried changing the Set XX field for All Rows to only the added row, and the updated row, and neither seems to make a difference. If anyone has any guidance on things to try, I am all ears.

CofCemails = (from c in Db.Customer where c.CustNum == ttOrderHedRow.CustNum select c.CofCEmails_c).FirstOrDefault()

Here are the specifics of the directive, just a start widget and a set field widget

It’s probably coming back null.

Add some checks and log it somewhere.

Remove the equal from there, I may have it wrong but that returns either true or false.

Instead of

CofCemails = (from c in Db.Customer where c.CustNum == ttOrderHedRow.CustNum select c.CofCEmails_c).FirstOrDefault()

Use

(from c in Db.Customer where c.CustNum == ttOrderHedRow.CustNum select c.CofCEmails_c).FirstOrDefault()

Any chance the OrderHed.Update BO isn’t getting triggered? When it’s not firing, can you recreate in your test environment? Is it customer-specific?

Turn on trace logging with BPM’s checked for a sales person, and then crawl through the logs after you’ve found a case where it’s missing.

1 Like

Andris you were right. I moved this to OnCustomerChange BO and now it is working.

1 Like