Found one more way for you, You can set the calculated checkbox true in the dictionary and use the below script:

(function calculatedFieldValue(current) {

	// Add your code here
	return current.assigned_to.department.name;  // return the calculated value

})(current);

 

find_real_file.png

The field will be read only and can not be editable. The only thing I noticed is the field will be automatically updated when the form loads.