Emperor Xian of Han
In 216, Cao Cao was granted the title of a vassal king, King of Wei, by Emperor Xian of Han and was allowed to set up an autonomous vassal kingdom, which was nominally still under the Han dynasty. Cui Yan was appointed as a Master of Writing () in Cao Cao's vassal kingdom. At the time, Cao Cao had yet to designate one of his sons as his heir apparent and he was considering Cao Zhi, so he secretly sought the opinions of his subjects, including Cui Yan. Cui Yan openly replied, "According to Confucian ethics, a man's heir apparent should be his eldest son. Besides, Cao Pi is kind, filial and intelligent, so he is a suitable successor. I fully support him until my death." Cao Cao was very impressed with Cui Yan for adhering to Confucian rules of propriety (and succession). (Cui Yan's niece was Cao Zhi's wife, so Cao Cao expected Cui Yan to support Cao Zhi, but Cui Yan followed the rules and endorsed Cao Pi (the eldest son) instead.) He promoted Cui Yan to Commandant of the Capital () later.