I have been working on trying to get a library function working. I am just trying to update the Task DueDate with a value passed to the function. The custom code completes without an error, but the DueDate field does not get updated.
I have verified:
- All parameters are being passed correctly to the function (Company, RelatedToFile, Key1, TaskSeqNum, DueDate)
- The GetByID call returns the correct record.
- The currentTask variable is populated with the first record (there should only be one record).
- My library has the “DB Access from Code” value set to “Read Write”
- The Task table in the library references tab is marked as updatable.
- No exceptions are being thrown.
My usings are:
- Erp.Contracts
- Erp.Tablesets
Am I missing something? Any thoughts @hmwillett ?
Here is the code snippet:
try
{
// Update the DueDate
CallService<TaskSvcContract>(svc =>
{
// Get task
var taskDs = svc.GetByID(RelatedToFile, Key1, "", "", TaskSeqNum);
// Get first row
var currentTask = taskDs.Task.First();
if(currentTask == null) throw new Exception("Unable to update due date.");
// Set the task properties from our DueDate parameter
currentTask.DueDate = DueDate;
// Save changes
svc.Update(ref taskDs);
});
}
catch (Exception e)
{
Error = true;
Message = e.Message;
}