Whenever in the judgment of the court the State is a necessary party to the action, the court shall make an order to that effect and thereupon a copy of all pleadings and proceedings on file with the court in the action shall be served upon the Attorney General who shall represent the State therein.