BPM to compare from other tables

I suggest looking up samples/tutorials of using LINQ.  LINQ would be able to query any table you want as long as you have the correct where clauses available. I do not believe there is a way to avoid using LINQ and C# for this bpm.  Basically you would query the tables using linq, possibly use descending/firstordefault on the date to get the last, assign variables with the column results and base the messages on the variable.
So I need some introductory help in creating a BPM.

Background:
1. version: E10.0
2. I do not know how to write C# code, although I can muddle my way through looking at a piece and guessing what it's trying to do.
3. This is my first time attempting to create a BPM other than the following along of the training packet.
4. I know how to write queries using the built in editor function of epicor.

So here's what I am attempting to do.

Upon approval of revision in the engineering workbench I want a warning box or a stoppage to pop up if 1 of these two conditions are not met.
1. The last operation is not backflush and the part is not set to phantom BOM.
2. The last condition is set to backflush, and the part is set to phantom BOM.

Any other condition besides that and I want to create a box that says you have an error. I can work out the verbage later.

Here's what I have so far.
I ran the trace while approving the revision in the engineering workbench. I used the BO EngWorkbench with ChangeECORevApproved. I used a pre-processing BPM.

No problems up to this point.

My first roadblock is, how to I run a condition against something not in the temporary tables from the ECOrev? I'm guessing that I have to run some custom code in the condition to run a query against the database. Can I get that code from a query built with the BAQ editor? or is that going to be very different? Or is there an easier way already programmed into the BPM designer?

Thanks,
Brandon
if the final operation has a specific OpCode... then this is very simple...

first you search for that operation, then you search for the part.... then use if statements to figure out whether you need a hard stop or not...

we dont have the exact scenario that you do... but this one is close to it...

when we release a job, we want Final Inspection to be marked as the final operation, and to go to the job assembly table and update that record too.

You'll have to change where I search for the operation on the job with the opcode for final inspection, to whatever you guys call your last operation.... then instead of searching for the JobAsbl table you search for the matching Part or PartPlant table...


Erp.Tables.JobOper JobOper;
Erp.Tables.JobAsmbl JobAsmbl;

foreach (var ttJobHead_xRow in ttJobHead)


{
var ttJobHeadRow = ttJobHead_xRow;
int vFinal = 0;
JobOper = (from JobOper_Row in Db.JobOper where
JobOper_Row.Company == Session.CompanyID &&
string.Compare(JobOper_Row.JobNum, ttJobHeadRow.JobNum, true) == 0 &&
JobOper_Row.OpCode.Contains("Final") == true
select JobOper_Row).FirstOrDefault();

if (JobOper != null)

{
vFinal = JobOper.OprSeq;


JobAsmbl = (from JobAsmbl_Row in Db.JobAsmbl where
JobAsmbl_Row.Company == Session.CompanyID &&
string.Compare(JobAsmbl_Row.JobNum, ttJobHeadRow.JobNum, true) == 0
select JobAsmbl_Row).FirstOrDefault();

if (JobAsmbl != null)

{

JobAsmbl.FinalOpr = JobOper.OprSeq;

}
}
}