Hi, im trying to use the JobClosing method to close/open jobs in a BPM but no luck so far. No error returned and strOut string at the end is blank. Any idea? Here is code below. Thanks
var JobClosingTable = new Erp.Tablesets.JobClosingTableset();
Erp.Contracts.JobClosingSvcContract hC = null;
hC = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobClosingSvcContract>(Db);
string strOut = “”;
bool blnInput = false;
if (hC != null)
{
JobClosingTable = new Erp.Tablesets.JobClosingTableset();
hC.GetNewJobClosing(ref JobClosingTable);
if (JobClosingTable != null)
{
var qDS = JobClosingTable.JobClosing;
foreach(var row in qDS)
{
row.JobNum = strJobNum;
row.QuantityContinue = 1;
row.JobClosed = true;
row.ClosedDate = DateTime.Now;
hC.PreCloseJob(ref JobClosingTable, out blnInput);
hC.CloseJob(ref JobClosingTable, out strOut);
}
}
}
I’ve outputed messages (PublishInfoMessage) between each line to make sure that everything runs. I also have a try catch (which is not catching anything).
would you be able to share your BPM with us? I’m trying to implement a method to close the jobs when a pack is shipped(Ready to invoice is checked). Thanks.
Hi - apologies for resurrecting such an old thread and thank you for posting the code.
I’m in the process of learning using custom code in bpms and data directives.
Question - how does one know/figure out to do this -
hC.GetNewJobClosing(ref JobClosingTable);
hC.OnChangeJobNum(YOURJOBNUM, ref JobClosingTable, out msg);
It looks like this populates the jobClosingTable with data from the job number - but outside of google and trial and error - I don’t know where to look for this info.
When I enable tracing - I get some references, but not seemingly all and googling seems to yield results - so how did you all figure this out in the first place?