Try this:
function cpStructWithChangedField(inStruct, chField::Symbol, newValue)
# type of struct
inType = typeof(inStruct)
# field count and names
fc = fieldcount(inType)
fn = fieldnames(inType)
args = (field_name == chField ? newValue : getfield(inStruct, field_name)
for field_name in fn)
return inType(args...)
end