When the Sun is emitting lots of radiation, its magnetic field shields the planet from cosmic rays.
I'm reading this a the sun's magnetic field. The shielding of earth from cosmic particles is the earth's. Let's assume you meant that. The earth's magnetic field is the reason the Van Allen Belts exist.