BPM Email upon Job Operation complete & include a few JobMtl rows

I have a working Data Directive BPM that will email upon an Operation being completed. I am unable to grab all the information necessary for the email i’m constructing.
I’ve been able to do this on another project where I was copying fields.

Here is the functional Send Email BPM. I know I need to get to the JobMtl table but i’m not sure how to query that so it shows up in the Send Email function.

Possibly execute some custom code? Or can I Invoke BO Method for JobMtl.Search

Try creating some variables and then using the Set Argument/Variable widget to populate each variable with some LINQ. Then when you create your email content your variables will be available to insert into the text.

1 Like

That got me 1 step closer thanks! Just need to do a lookup now.

This is just a quick example I keep on hand to write quick lookups. Selects a single field from multiple joined tables.

(from orderhed in Db.OrderHed
    join customer in Db.Customer on orderhed.CustNum equals customer.CustNum
    join salester in Db.SalesTer on customer.TerritoryID equals salester.TerritoryID
    join salesrep in Db.SalesRep on salester.ISC_c equals salesrep.SalesRepCode
  where orderhed.OrderNum == dsOrderHedRow.OrderNum
  select salesrep.EMailAddress).FirstOrDefault()

I created the lookup code in SQL, but i do not know how to translate into C# or LINQ.

select JobMtl.PartNum as [tPartNum],
JobMtl.Description as [tPartDesc]
from erp.LaborDtl as LaborDtl
left join Erp.JobMtl as JobMtl on
LaborDtl.JobNum = JobMtl.JobNum
and ( JobMtl.Description like ‘Nameplate%’ )
where (LaborDtl.JobNum like ‘1164%’)

1164% can be replaced with ttLaborDtl.JobNum

Since I avoided the C# lookup, here is how I accomplished this. Unfortunately, this dumps the entire job BOM into the email with “,” delimiter. Not the greatest solution, i’m really only searching for parts that meet specific criteria.

This did not populate my variable. tJobMtlPartNum

So I just dumped both fields into the email.