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
Off the top of my head and assuming the JobNum is using the Order-Line-Rel format …
Data Directive: OrderDtl.Update / Standard
Make a string variable DescOnJob
Make a string variable CommentsOnJob
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()
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()
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.
It doesn’t check if the job is closed. That’s easy enough to add in the WHERE criteria of those LINQ expressions.
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.
Here’s a super-hack that might work - if you have APR (Advance Printing with Break/Routing).
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.
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.
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.
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…
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.
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).
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: