We construct the exact partition function of the Potts model on a complete graph subject to external fields with linear and nematic type couplings. The partition function is obtained as a solution to a linear diffusion equation and the free energy, in the thermodynamic limit, follows from its semiclassical limit. Analysis of singularities of the equations of state reveals the occurrence of phase transitions of nematic type at not zero external fields and allows for an interpretation of the phase transitions in terms of shock dynamics in the space of thermodynamics variables. The approach is shown at work in the case of a q-state model for q=3 but the method generalises to arbitrary q.