Why is BPM message not picking my up UD field?

I’m creating a BPM to prevent closing an order (hed, dtl, release eventually) when the CancelReason_c UD field is not set. I haven’t been able to get the condition to trigger on NULL or “”, so I figured I should try it with values first, but the message box doesn’t show the field is set. I’ve also tried it with ALL ROWS and THE CHANGED ROW, but it still is empty (per the message box). The BPM is always false.

CancelReason_c is linked to user codes driving a dropdown box, if that matters.

A BAQ shows that the reason was set on OrderHed.CancelReason_c.

What am I missing?

image

image

image

image

image

Try creating a variable, and setting it with a “Set Arg/Var” widget. Since it is an existing record, use the “Simple one-liner” method to read the value from the real DB table, instead of the temp table.

Then reference the variable instead of the temp table field.

Here’s the referenced technique

https://www.epiusers.help/t/simple-one-liner-c-to-retrieve-data-from-a-table/44627/2?u=ckrusen

Thanks, Calvin! Gottit! Good news is that shipping an order doesn’t seem to use the CloseOrder bpm, so I didn’t have to figure out how to escape that use-case…

I did a Track Changes trace, and literally nothing is getting sent. It’s all in the return.

Here’s the code (first time having to use the iOrderNum parameter for me. Ooooh!):

Db.OrderHed.Where( r =>r.Company == callContextClient.CurrentCompany && r.OrderNum == iOrderNum ).Select( r =>r.CancelReason_c).FirstOrDefault()

Trace:


<snip 500 lines of the same return values>
image

Then got the empty variable this way (I can never remember why sometimes I can use null, and other times “”):
image

image

Edit

Guess You responded while I was composing my reply. Glad you got it working

End Edit

I was thinking something more like:

image

  1. Make the variable:
    image

  2. Set the variable
    image
    (note that I don’t include the UD field in the Where clause. It’s what I retrieve in the Select clause. )

  3. Compare the variable:
    image
    (My UD field is required so I couldn’t test against a blank, but you could test yours against blank or null)

  4. Exception on true condition

giving you:

I often test for both, OR’ing those two conditions