Insert project name instead of project serial number into a custom field

For some internal administrative reasons, the salary register is required to have a project name column that is matched to an employee when running the payroll. I have a custom field called project_name on the Employee document that is linked to the Project document and I am able to pull this field into the Salary Register. But my concern is that only project serials are being displayed instead of the Project Name. Could you please suggest a few pointers or hacks on how to achieve this?

You may need to use custom script according to your needs to override link field data.

I have tried with the following custom script but I can’t seem to get it working. What could be missing in the script?

frappe.ui.form.on("Project", {
        onload: function (frm) {
            frm.set_query('project', function(doc) {
                return {
                    filters: {
    					'link_doctype': 'Project',
    					'link_name': doc.project_name