Errors thrown when deleting linked tasks

Hi guys,

I have an issue that is happening when i delete a task that is linked to another task. I am running in REST mode with .NET on the server side - When i debug, and step through the code I hit this first:

    [HttpDelete]
    [Route("gantt/task/{id}")] // must be <BaseURL>/task/{id} to work with gantt
    public ActionResult DeleteGanttTask(int id)
    {
      try
      {
        _ganttBl.DeleteTask(id);
        var response = new {action = "deleted", sid = $"{id}", tid = $"{id}"};
        return Json(response);
      }
      catch (Exception ex)
      {
        _log.Error(ex);
        var response = new {action = "error", sid = $"{id}", tid = $"{id}", details = ex.Message};
        return Json(response);
      }

THEN it hits this:

    [HttpDelete]
    [Route("gantt/link/{id}")] // must be <BaseURL>/link/{id} to work with gantt
    public ActionResult DeleteGanttLink(int id)
    {
      try
      {
        _ganttBl.DeleteLink(id);
        var response = new {action = "deleted", sid = $"{id}", tid = $"{id}"};
        return Json(response);
      }
      catch (Exception ex)
      {
        _log.Error(ex);
        var response = new {action = "error", sid = $"{id}", tid = $"{id}", details = ex.Message};
        return Json(response);
      }
    }

The issue comes when it steps to the DeleteGanttLink, it is trying to delete a link that no longer exists. Which throws an alert “undefined”… did something change? We are running 4.1.9 Professional - The code works fine when just trying to delete a link, but this is not efficient for users who need to delete a large amount of tasks. Any ideas? I can provide more code, but can’t reproduce in a snippet.

Hi,
in your case REST mode first invokes deleting a task, then deleting links that is joined to task, so your order is right. And you should catch the link ID inside DeleteGanttLink. It seems like you’ve got undefined instead of proper ID. Please at first check the HTTP headers inside dev tools.
Did you use setTransactionMode(“REST”) like this docs.dhtmlx.com/api__dataproces … nmode.html
I’ve just checked REST in this github.com/DHTMLX/gantt-node-mysql and it seems to be working fine.