Dynamic list in links field Project and Task

Hi! I have 2 fields in a Custom Doctype, both links, Project and Task. I want to choose a Project and then choose the task, but just to appear the task of the choosen Project. I want to do the same that is in the Timesheet. Can somebody help me? Thanks,

Elian

Try filtration something like this.

frappe.ui.form.on("Doctype Name", {
	setup: function(frm) {
		frm.set_query("task", function() {
			return {
				filters: [
					["Task","project", "in", [frm.doc.project]]
				]
			}
		});
	}
});

It works, thank you very much!