Assign To Filter in Custom HTML Blocks

Dear Frappe Community,

I want to create a cusotm script for a user workspace with a custom html block that shows the task only assigned. to user. but I cannot get it to work.

_assign
assigned_to and many other variables are not working.
Please help :pray:

This is my current working code where I need a filter for Assigned To to be like the current.user.

html:

<table class="table table-bordered table-condensed" id="task_table"></table>
frappe.call({
    method: "frappe.client.get_list",
    args: {
      doctype: "Task",
      filters: {
        status: ['In',["Open", "Overdue"]]
      },
      fields: ["name", "subject", "status", "project", "priority"],
    },
    callback: function (response) {
      if (response.message) {
        populateTaskTable(response.message);
      } else {
        console.error("No task list data found.");
      }
    },
    error: function (xhr, status, error) {
      console.error("Error fetching task list:", error);
    },
  });

  function populateTaskTable(tasks) {
    var taskTable = root_element.querySelector("#task_table");
    var tableHTML = "<thead>";
    tableHTML += "<thead><tr><th>Task ID</th><th>Task</th><th>Status</th><th>Priority</th><th>Project</th></tr></thead>";
    tableHTML += "<tbody>";

    tasks.forEach(function (task) {
      tableHTML += "<tr>";
      tableHTML += "<td><a href='/app/task/" + task.name + "'>" + task.name + "</a></td>";
      tableHTML += "<td>" + task.subject + "</td>";

      var statusColor = task.status === "Overdue" ? "red" : "green";
      tableHTML += "<td style='color: " + statusColor + ";'>" + task.status + "</td>";

      var priorityColor = "";
      switch(task.priority) {
        case "Urgent":
          priorityColor = "red";
          break;
        case "High":
          priorityColor = "orange";
          break;
        case "Medium":
          priorityColor = "#8B8000";
          break;
        case "Low":
          priorityColor = "green";
          break;
        default:
          priorityColor = "inherit";
      }
      tableHTML += "<td style='color: " + priorityColor + ";'>" + task.priority + "</td>";

      tableHTML += "<td><a href='/app/project/" + task.project + "'>" + task.project + "</a></td>";
      tableHTML += "</tr>";
    });

    tableHTML += "</tbody>";

    taskTable.innerHTML = tableHTML;
  }

Hey @pronext,

Looks really good mate. To add the filter for Assigned Users you need to do a ‘like’ filter with wildcards at the beginning and end:

method: “frappe.client.get_list”,
args: {
doctype: “Task”,
filters: {
status: [‘In’,[“Open”, “Overdue”]],
_assign: [‘like’, “%” + frappe.session.user + “%”]
},
fields: [“name”, “subject”, “status”, “project”, “priority”],
},