I am using the LotSelectUpdate service inside a BPM. I am setting the PartLot.ExpirationDate field inside the code, but it’s not actually setting it. I am getting though the entire code as shown by my messages, but the record doesn’t update.
/*Look Up Part Lot Rec and Update the Expiration Date from the Date06 field*/
foreach(var rec in ttUD100.Where(tt=>tt.Updated()))
{
if(rec.ShortChar05 == "CTS")
{
/*LotSelectUpdate Svc*/
/*Attempt to find Part Lot rec*/
using(var svc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.LotSelectUpdateSvcContract>())
{
/*create PartNum, LotNum as strings, just to be safe*/
string partNum = rec.Key2.ToString();
string lotNum = rec.Key1.ToString();
var ds = svc.GetByID(partNum, lotNum);
if(ds!=null)
{
DateTime uDate = Convert.ToDateTime(rec.Date06); //Supplier Expiration Date
DateTime plDate = Convert.ToDateTime(ds.PartLot[0].ExpirationDate);
string msg2 = uDate.ToString() + " " + plDate.ToString();
this.PublishInfoMessage(msg2, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "FirstVar","SecondVar");
/*Attempt to match up corresponding UD100 rec, if true update PartLot.ExpirationDate from UD100.Date06*/
//if(DateTime.Compare(uDate, plDate)!=0)
//{
ds.PartLot[0].ExpirationDate = Convert.ToDateTime(DateTime.Parse("2018-09-01"));
/*Update*/
svc.Update(ref ds);
string msg3 = "Made it past Update";
this.PublishInfoMessage(msg3, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "FirstVar","SecondVar");
// }
}
}
}
}
Before:
During:
After:
As you can see, it processed all the code but didn’t update the field. I am able to update the field using the BL Tester and the Update method and it works fine.
What’s going on?