Dominate Person Quandary

A mage cast dominate person on two gnolls, and both failed their saving throws. He does not share a language with them, but an ally coached him in Gnoll to tell the gnolls to follow another that ally’s commands, the one who knows Gnoll. Would this work?