I have a BPM on JobMtl to stop a user from putting parts onto a Job that aren’t in the parts data. It works fine for what I want but when we try to receive something that was put on a job before this was in place it stops them from receiving it since it isn’t in the system. How do I tell that the receiver process is calling the BPM vs the job process calling the BPM?
When you say BPM, do you mean data directive? I assume yes because you said it’s on JobMtl. If it’s a data directive, it doesn’t matter whether its the receipt or the job process in Epicor because you’re setting up the BPM on the table update itself.
If I think about the business logic, it sounds like you are trying to prevent people from putting parts on a job that aren’t parts in the system (Epicor calls these parts on the fly). Now that you’ve stopped jobs from having that happen going forward, you are stuck dealing with the jobs that were already setup this way prior to the BPM. Without seeing you BPM logic, it’s hard to say what might be the problem. I could speculate… but it would be better if you could copy/paste your BPM (either the code or screen shots of the widgets).
And the custom code is
string JobNum = "";
JobNum = ttJobMtl.FirstOrDefault().JobNum;
var JobInfo = (from JobHead_Row in Db.JobHead where JobHead_Row.JobNum == JobNum select JobHead_Row).FirstOrDefault();
if (JobInfo.JobType.ToString() == "MFG")
{
checkPart = true;
}
else
{
checkPart = false;
}
So you’re only checking MFG jobs… and if you find a part number that doesn’t exist in Part table, you’re throwing an exception, correct?
It looks like you need to add some more criteria at the beginning because you’re going to pickup every change to the JobMtl table… not just the “added rows”. So you’re preventing anyone from updating those jobs in addition to creating new ones. That’s my guess.
Yes, I am throwing an exception when it doesn’t exist in the part table. My question is how do I tell if the receiver is calling it or the job process is calling it? Is there some parameter, system variable, etc somewhere that I can check?
You can turn on trace logging. Then have someone try to receive the part in question. Then review the trace logs. Are you familiar with that? It should show you which BO methods are being called and if you select the right boxes, you can see what fields are trying to be changed by each method call.
You can check the calling assembly from a property in the client call context, from the BPM.
What property? Is that something I need to write custom code for?