So the relay is clicking but it is not switching the electromagnet. Check the supply to the relay contact and that the power is getting from the relay to the electromagnet and that the earth return from the electromagnet is OK.
Follow the power!
XXX
August 2016