Use a custom function to auto-fill an empty field

Use a custom function to auto-fill an empty field

In each of our potentials we have the standard field 'Potential Owner' and a secondary user field called 'Relationship Manager'.

I would like to create a custom function which auto populates the 'Relationship Manager' with the same name as the 'Potential Owner' if it has been left empty.

Any help with the function appreciated.