Screen shots of the data view > options of the sub-relational fields are attached.
(Note the additional lines beginning with "On lookup . . ." in User Name data view > options. That's the only difference I can find between the two sub-relational field definitions.)
Snippet that returns a value:
var text1 = GetFieldValue("User Dept");
SetFieldValue("USER_DEPARTMENT", text1, "true");
Snippet that returns "null":
var text1 = GetFieldValue("User Name");
SetFieldValue("USERNAME", text1, "true");