You could just use an ESInputTag to whole the value for SimpleMagneticField. An ESInputTag allows an empty value which would give you the same result as the get call after the else. That way you do not need the if...else block.