Updating Task Table Record From Function Not Working

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:

  1. All parameters are being passed correctly to the function (Company, RelatedToFile, Key1, TaskSeqNum, DueDate)
  2. The GetByID call returns the correct record.
  3. The currentTask variable is populated with the first record (there should only be one record).
  4. My library has the “DB Access from Code” value set to “Read Write”
  5. The Task table in the library references tab is marked as updatable.
  6. No exceptions are being thrown.

My usings are:

  1. Erp.Contracts
  2. 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;
}

1 Like

Add currentTask.RowMod = "U"; before doing an update.

4 Likes

Thank you!! That worked! I really appreciate it!

1 Like