Context : Investigating the magnetic field structure in the innermost regions of relativistic jets is fundamental to understanding the crucial physical processes giving rise to jet formation , as well as to their extraordinary radiation output up to \gamma -ray energies . Aims : We study the magnetic field structure of the quasar CTA 102 with 3 and 7 mm VLBI polarimetric observations , reaching an unprecedented resolution ( \sim 50 \mu as ) . We also investigate the variability and physical processes occurring in the source during the observing period , which coincides with a very active state of the source over the entire electromagnetic spectrum . Methods : We perform the Faraday rotation analysis using 3 and 7 mm data and we compare the obtained rotation measure ( RM ) map with the polarization evolution in 7 mm VLBA images . We study the kinematics and variability at 7 mm and infer the physical parameters associated with variability . From the analysis of \gamma -ray and X-ray data , we compute a minimum Doppler factor value required to explain the observed high-energy emission . Results : Faraday rotation analysis shows a gradient in RM with a maximum value of \sim 6 \times 10 ^ { 4 } rad/m ^ { 2 } and intrinsic electric vector position angles ( EVPAs ) oriented around the centroid of the core , suggesting the presence of large-scale helical magnetic fields . Such a magnetic field structure is also visible in 7 mm images when a new superluminal component is crossing the core region . The 7 mm EVPA orientation is different when the component is exiting the core or crossing a stationary feature at \sim 0.1 mas . The interaction between the superluminal component and a recollimation shock at \sim 0.1 mas could have triggered the multi-wavelength flares . The variability Doppler factor associated with such an interaction is large enough to explain the high-energy emission and the remarkable optical flare occurred very close in time . Conclusions :