BPM On OrderDtl Table Help

Afternoon all,

Gotten my head stuck in writing a BPM to put validation on Sales Orders. What I’m trying to achieve is for certain customers, all sales orders require a Project ID, so if other is raised without, error.

So far I’ve got it to a stage where it will do what I want based on there being a ProjectID or not, but what I’m getting properly stuck with is adding the customer criteria stage.

I’ve tried a handful of options, but all seem to result in the bpm firing every single time regardless of customer or projectID field being populated.

If I take out the customer check condition like in the attached, it works as I want, just for all customers, not just the two I need it to. :sweat_smile:

Any pointers would be great. I’ve tried using CustNum for both records to do it, and everything else I try just seems to make it worse haha.

Bit of a long shot but have you noticed that OrderHed uses “CustNum” in most of its work but in the UI its “Customer.CustID” pulled from the Customer object?

IE if you’re passing a number you think is the CustNum but its actually the CustID you’ll never evaluate to “true”

The thought had crossed my mind, and I have done some experimentation with exactly that.

When it comes to conditions,

The specified field has been changed from Any to Another only allows int values to be input, so rules that condition out.

Tried utilising Number of Rows in the designed query is more or equal to 1, with the query being a simple Customer Table with the criteria set to only show the customers I want this to fire for.

It’s one of those ‘it must be so stupidly obvious once you know’ scenarios.

Try “the specified field of all rows is equal to” option and set it to OrderHed.CustNum or CustID (either/or). Note the “all” in there. If that works you can narrow it down to “changed” rows and see if it still fires as intended.

Though, honestly, the “number of rows in the designed query” option should have worked. The BAQ and the specified field methods are, IMO, the most consistent. The “field changed” sometimes works, because of when/how a particular method marks a field as changed.

If none of this works, you can also do a data directive instead. Those behave more consistently than method directive (they’re looking at DB writes and not objects in memory) but as a rule that should be a last resort for reasons you can look up on here.

It seems a little odd that you’re coming out of the false side of the condition, is that intended? Can you make a screen shot of the condition that you want to work so we can see that?

Ah. I’m trying to do it on a Data Directive because I had no luck on a Method directive funnily enough. Which might be why I can’t utilise the OrderHed table when I’ve put the BPM on OrderDtl?

It’s more a case of what I managed to get it to work. My logic was ‘Has the field been populated? Yes? Great, do nothing. No, okay, throw an exception.’

Attached is kind of what I’m trying to achieve, though the condition is set to a single instance in this example, not the two that I need.

Are you triggering this with the web UI or classic?

The reason I ask, is because those “is it changed” BPM’s rely on 2 rows being passed from the client. One with the original data, and one with the changed data. The client traditionally passes both, but the web UI is not going to pass both anymore. (There’s another thread about BPM’s not working the same in both environments).

So to check that, pop up a message box with a table query (right click in the message and it give you options to add that) and make sure there are 2 rows being passed. One with a row mod of some sort, and another with no row mod.

If there aren’t 2 rows, that’s why your condition isn’t working. It has nothing to compare the new data to. Instead you’ll have to look up the “Old” data in the database, then compare the temp record with what’s in the database, and act on that.

Oh interesting. Classic all the way, we’ve been using Classic and the client since we went live Feb 22.

Just reporting back to say I’ve got it to work, thanks all.

Changed to using a Method Directive, and changed pretty much all my conditions to ‘Number of rows in is more than or equal to 1’, and it’s firing as I’d hoped.

Did have to put in an extra condition to only fire when a part had been put in, but aside from that I think I’m good.

Thanks for all the pointers, got there in the end.

1 Like