Get an attorney involved now. The CPS order takes precedence if you're a party to both the CPS order and the custody order.
I am not intending this to be legal advice, because I don't know the particulars of your situation. Call me if you would like to discuss this or other isues.
Sign up to receive a 3-part series of useful information and advice about child custody law.