BPM blocks cripple my thinking - how can I do a simple check on all order lines?

,

We are limited to blocks only, no code.

When a user changes the description or job comments on an order, I want to check if the description and comments match on the corresponding job (if a job exists). If they don’t match, I want to send an email with the jobs that will have to be pulled and updated.

I can think of how make a BAQ that would find these cases, and coding something would be trivial. But whenever I try to do something with multiple records using only BPM blocks I get stuck so fast.

I’ve done similar with checking on other fields related to Orders and Jobs, your friend here will be the Db.JobProd table,

If you’ve had experience with BPM’s

I would do a BPM Method (or directive) on OrderDtl that checks if the field in question has changed from any to another. (simple to use a widget for this part)

Then

Link it up to the Job using the JobProd table and then check if the OrderDtl field == JobHead field

If there is a difference between the two fields you can then get it to email you (or whoever entered the Job/Order)

The JobProd table shows what line of the Sales Order that the Job is linked to

I have moved away for using BPM widgets to using “Execute Custom Code” in BPM’s, I’ve found more flexibility with it

Edit: Sorry I just reread your post, Limited to no code… @ckrusen often comes up with good ideas using blocks/widgets

Edit 2: You will most likely have to use a Data Directive, there is no Method directly for OrderDtl

1 Like

When you say “no code”, I assume you mean the Exec Custom Code widget.

Are you opposed to simple single line of code in a widgets expression field?

1 Like

Nope, no problem with those, been trying to use that to my advantage.

Off the top of my head and assuming the JobNum is using the Order-Line-Rel format …

  1. Data Directive: OrderDtl.Update / Standard

  2. Make a string variable DescOnJob

  3. Make a string variable CommentsOnJob

  4. Use the Set Variable widget to set the var DescOnJob using:
    Db.JobHead.Where( r =>r.Company == callContextClient.CurrentCompany && r.JobNum == (ttOrderDtlRow.OrderNum.ToString() + "-" +ttOrderDtlRow.OrderLine.ToString() + "-1")).Select( r =>r.PartDescription).DefaultIfEmpty("No Job Found").FirstOrDefault()

  5. Do the same for var CommentOnJob:
    Db.JobHead.Where( r =>r.Company == callContextClient.CurrentCompany && r.JobNum == (ttOrderDtlRow.OrderNum.ToString()+"-"+ttOrderDtlRow.OrderLine.ToString()+"-1")).Select( r =>r.CommentText).DefaultIfEmpty("No Job Found").FirstOrDefault()

  6. Make a condition with:

  7. Then connect an email Widget to the True output.

edit

couple of caveats…

  1. This assumes that only one release exists (thus the Jobnum ending with "-1"). If you have multiple releases and each with their own job, you’d have to get more complicated to check other releases. The inability to loop in a widget only BPM, would make you have to set some upper limit on the number of jobs to look for.
  2. It doesn’t check if the job is closed. That’s easy enough to add in the WHERE criteria of those LINQ expressions.
  3. It sends a separate email for each line that is changed. Not sure if you could make it be just one email. Even with a Method Directive on SalesOred.Update, I think that fires after changing a line and then moving to another.
1 Like

They blocked your backdoor trix… Can’t get BPM Advanced User Privileges on MT:

That stinks!

Here’s a super-hack that might work - if you have APR (Advance Printing with Break/Routing).

  1. Create a BAQ Report that includes the fields from the Order and the JobHead, and a calc field that indicates if a job exists and either of those text fields differ.

  2. Add a Break/Routing to that report style, that only prints if that calculated field is set. And instead of printing, it actually sends an email.

  3. In your DD, use an Auto Print widget to print that BAQ report every time PartDesc or PickListComments changes. The BAQ will “check” if the job exists, and if it doesn’t no email is sent.

Unless you’re another company in Evan’s tenant reading his data… :thinking:

3 Likes

What do you do when a query returns results in a BAQ designer but the exact same thing in the BPM query designer returns no results…?? I didn’t realize they were that different…

Or how about this Method Directive on SalesOrder.Update

with Condition’s qryJobs of:

And the table Criteria:

And by adding the JobProd table in there, it doesn’t requires that the JobNum be in the
OrderNum-Line-Rel format.

That seems to simple… I must be missing something.

I was trying something very similar to that, it gets results in the BAQ designer but not the BPM one… very strange

I’ve got exactly what you have shown, but it seems to think the comments don’t match even when they do… Any ideas?

I tried Not Matches as well, same problem:

I think it might need to be a Pre-Proc, as the ttOrderDtl fields appear to be blank after the BO method executes.

Also … Do you really need to know if the order and job text is different? Wouldn’t any change of either text on the order AND a related job existing be sufficient?

Also, none of this would catch the text being changed on the job.

I think this will work (with some limits)

image

Condition0:

With the JobProd query:

image

Note that’s the ttOrderDtl table and not the ttOrderRel table. And that there’s no relationship to the Release number.

It won’t be able to tell you the JobNum’s that don’t match, but you could use order tracker with the OrderNum and OrderLine to find the related job(s).

And before I get scolded for linking a ttTable to a Db table …

Make variables to hold the OrderNum and OrderLine, then make the JobProd query:

image

3 Likes

I ended up doing this a slightly different way because I wanted the exact lines with differences.

  • Pre-processing BPM - if description or job comments changed enable post processing BPM.
  • In post processing BPM, fill table with query containing both job and order descriptions and comments. Put the job description in Character01 and the job comments in Character02.
  • Make a boolean variable and assign it the following:
  • If the boolean is true, make a list of lines with mismatching information with the following string variable:

Then the list of order lines with problems can be used in an email etc.

1 Like