I want to automatically generate Mfg Lot attribute. For this I need the JobNumber data.
Process is something like this:
In the “Part Maintenance” is set Lots -> MFG Lot = Tracked.
In the “Job Receipt to Inventory” is entered JobNumber, quantity and Lot Number.
When I click OK, then “Part Lot Attribute Entry” opens and “MFG Lot” attribute must be generated automatically.
I created customization for “Part Attribute Entry”, but there is no JobNumber in the dataset.
I also tried save the JobNumber info to the CallContextBPM field in the “Job Receipt to Inventory”, but this info is not sent to other form.
Any idea how to do this?
Thank you for your response.
I have used many times BAQ in the customization and I know how they works.
The problem is that at this point I cannot find any database table, from where to query JobNumber if I know a LotNumber. All this data is only in the “Job Receipt to Inventory” form memory and will be saved after MfgLot attribute is entered.
When from “Job Receipt to Inventory” is called the “Part Lot Attribute Entry”, then I need to send someway JobNumber to the “Part Lot Attribute Entry”.
Any idea, how to send data from process to the subprocess?
A way of doing it (from Part Lot Attribute) is by accessing the jobnum value (KeyField) in Form.trans using reflection. Before that, you gotta find the source form in Application:
foreach (Form f in Application.OpenForms)
{
if (f.Name == "RcptToInvForm")
{
BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
Type type = f.GetType();
var field = type.GetField("trans", flags);
var transObj = field.GetValue(f);
Type transType = transObj.GetType();
var keyField = transType.GetProperty("KeyField",flags).GetValue(transObj);
}
}
where keyField holds your value. Not elegant…consider it as your plan B or C or whatever
Again, it’s not an ideal solution but… Be aware if there is more than one Job Receipt To Inventory open, you’ll have to handle that scenario (maybe by comparing values (LotNum maybe) or something else).
I tested scenario when one Job Receipt was opened from Epicor and another from MES (same workstation). There was different JobNumbers and it works correctly!
If I understand correctly, then customization uses only the local workstation, not a Epicor App server.
Not like BPM, which works in the Epicor Appserver.