Does the solenoid coil have the function of?

From creating a magnetic field, attracting the nucleus of this field and generating a desired movement.