Field change trigger for custom field doesnt seem to work?

Frappe v14.

I have a custom field in the Task Doctype called workflow_state. This is a custom field added by the Workflow Doctype attached to some workflow. When the value of this field changes I want to do some actions in the client script.

This seems to work only for standard fields and not for custom fields.


frappe.ui.form.on('Task', {
    // this is standard field in the doctype for which I am able to detect the change 
    // and do some actions
    priority(frm)
	{
		console.log(frm.doc.priority)
	},

    // for this field I am not able to detect a change and there is no output on the 
    // console
    workflow_state(frm)
	{
	 	console.log(frm.doc.workflow_state)
	}
})

// Additionally I tried to create a seperate function which also does not work
frappe.ui.form.on("Task", "custom_workflow_state", function(frm) 
{
	console.log(frm.doc.workflow_state)
});