Bpm / baq Throws Exception if Quote is Quoted

Hi All - seems like an easy one but I’m stumped. I need to make a BPM that throws an exception if a quote is marked quoted and on the QuoteAsm table the part description of part 6520 contains the string “Alum” somewhere in the description. I can’t get a condition to work that can check if the description contains something.

I tried doing if the number or rows in the query is not equal to 0 but can’t get the BAQ to work right. Trying to use the MATCHES with a wildcard isn’t working. So QuoteAsm.Description MATCHES … the constant… “Alum”.

Anyone have any ideas?

Don’t join tt to DB this is going to cause a lot of issues.
(Long Story see Joining "TT" records to regular DB records in BPMs)

What I recommend is that you add the QuoteNumber to a variable in an initial widget, then simply bring ERP.QuoteAsm and add a filter on that variable.

That “MATCHES” uses RegEx.IsMatch
So don’t use Wild Cards there simply type “Alum” in quotes


The other way is to create a BPM Variable called QUOTENUM, and assign that with a widget that takes ttQuoteHed.QuoteNum and puts it into QUOTENUM.
THEN create a query that only looks for QuoteDtl records where the QuoteNum = QUOTENUM and partnum contains ALUM

yet another way is to do this completely with code…

  1. create a BOOLEAN variable called “AlumPartFound”
  2. create a code block with the code below
  3. create a condition widget that checks for AlumPartFound = true and raise your exception.

UNTESTED (but something like this should work) code below:

AlumPartFound = false;
var ttqh = ttQuoteHed.Where(x=>x.RowMod != "").FirstOrDefault();
if (ttqh != null){
   AlumPartFound = Db.QuoteAsm.Any(x=>x.QuoteNum == ttqh.QuoteNum && QuoteAsm.Description.Contains("Alum"));