Hey everyone, I’m currently working on a BPM to process data from the Sales Order form and transfer it to the corresponding Project in the Update pre-processing call.
The code seems to execute fine with no errors but when I go look at the project, the data has not been updated. Any ideas as to why this is happening?
Thanks in advance for your help!
foreach(var ttOrderHed_iterator in (from ttOrderHed_Row in ttOrderHed
where ttOrderHed_Row.Updated()
select ttOrderHed_Row) ){
var ttOrderHedRow = ttOrderHed_iterator;
using(var svc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ProjectSvcContract>())
{
ProjectTableset ts = new ProjectTableset();
ts = svc.GetByID(ttOrderHedRow["ProjectID_c"].ToString());
foreach(var x in ts.ProjectTask.Where(r => r.TaskID == "008-OPPR"))
{
x.DateComplete = Convert.ToDateTime(ttOrderHedRow["ProdReadyDate_c"]);
}
svc.Update(ref ts);
}
}
This is pre processing and you are are looking at only RowMod Upated() so it won’t run on New Orders… So keep that in mind in case you are testing with a Brand New Order.
Also Set a RowMod=“U” in x (your Project Task)
Are there any conditions previously in the BPM?
Also use info Messages to see if the code is actually executing
Thanks so much for the quick response. All I had to do was set the RowMod=“U” and the BPM ran perfectly, I didn’t realize the I had to manually set that in this case.
Also will definitely be using the Messages in the future to help debug. Thanks again.
I will definitely use that instead. In terms of efficiency, I am currently checking only if the row as a whole has been updated, and also if a certain boolean has been set. Is there a way to check if that certain boolean field inside the ttOrderHed row has been changed?