List View: add project name in task list

How can i load the project name (instead of project id) to my task list view?

Generally i think it make sense to show the names instead of the ids in the list views.

Note: I dont want to add a new field with the name and save them to the task directly, i want to load the related name.

regards and thanks


The task list here has the project name , and I can’t find the project id field in the Project doctype. Is there something I am missing?

Why not? This achieves the same result and is much easier to do.

As you can see my project name is “Testprojekts” and the id “PROJ-0023”

Under my task list the only field i can add is the “Project” but this returns me the project id

Can this be a bug?

because the project name would be hardcoded, the project name can be changed regularly. if i want this updated immediately i have to write a server script or go into the task remove and re-add them into the task and save the task to have the updated project name.

In the list in my first post, the name and id are the same , the project was provided in the installation as an example. Upon creating a new project and task , the problem you have described is confirmed. After clicking on the id and changing the id to match the name, the task list shows the new id, although that may not be what you’re looking for.

ok, so it looks thats the default case. does anyone have a simple idea how to solve (without save them hardcoded - because of the problems described above)?


Name is not the same field that project_name. The term “Name” is a bit confusing. Every doctype have his own “Name” field, that represents the id of the row in the database. This name is defined by a naming strategy on each doctype.

In this case (Project Doctype) you can see the both fields on database …

About your main requirement … Probably the easier way is adding a custom field on your doctype, fetching the project_name and storing it on task doctype.

Other approach is using virtual docfields, avoiding store data in task field, but this kind of fields are not usable in listviews.

Maybe you could workaround customizing listview with formatters, on a simple client script. This technique allows to process the data showed in listview:

frappe.listview_settings['Task'].formatters = {
        return 'nametoshow'

Maybe you can use frappe.db.get_value to return the project name from project doctype, but i’ve not tried this. Seems not a good way, because this will trigger one call for each row on listview …

More about formatters here:

Hope this helps.

1 Like

hey thanks for your response and sorry for my delayed answer.

I’ve added them via formatters and cache the result per project-name so i dont make more ajax calls as needet.


1 Like

Hi! Sound interesting! Could you share your script or code for this?


yes its pretty simple.

let cached = {};
const getName = (name) => {
    if (name in cached) {
        return cached[name];
		method: 'frappe.client.get_value',
		args: {
			'doctype': 'Project',
			'filters': {
				'name': name
			'fieldname': 'project_name'
		async: false,
		callback: function(r) {
			if (r.message.project_name) {
			    cached[name] = r.message.project_name

    return cached[name];

frappe.listview_settings["Task"] = {
    formatters: {
        project: (val) => {
            const name = getName(val);

            return name;

add this to the client scripts in the specific doctype :slight_smile:

If you have any questions let me know.


1 Like

can we setup the “Task List View” filtered by only completed_by certain user to?