[1] It was said that Zhang Rendan was talented in both civil and military matters when he was young, and early in Wu Zetian's Zhou dynasty, he was made Dianzhong Shi Yushi (殿中侍御史), a low-level imperial censor.
In 696, when Wu Zetian commissioned the chancellor Wang Xiaojie to attack Tufan, Zhang Rendan was made the auditor for the campaign.
Sun was demoted to be a county magistrate, and Zhang was promoted in his stead, and sometime thereafter was made acting commandant at You Prefecture (幽州, roughly modern Beijing).
When Eastern Tujue's khan Ashina Mochuo subsequently invaded and, after capturing Zhao (趙州, roughly modern Shijiazhuang, Hebei) and Ding (roughly modern Baoding, Hebei) Prefectures but then withdrew through You Prefecture, Zhang tried to intercept him, and in the battle suffered an arrow wound to the hand.
When he arrived at the army camp, Eastern Tujue forces were withdrawing, and he made a surprise attack against them, inflicting much losses.
In 708, while Ashina Mochuo was busy fighting with Tuqishi (突騎施) forces in the Western Regions (Xiyu), Zhang wanted to take advantage of Ashina Mochuo's absence to cross the Yellow River in the bend region (in modern western central Inner Mongolia), which had served as the de facto border of Tang and Eastern Tujue, and he submitted a proposal to build three forts north of the river to cut off the route that Eastern Tujue usually took in invading Tang territory.
The chancellor Tang Xiujing, himself a successful general, opposed, believing that the forts would be difficult to defend and would eventually fall into Eastern Tujue hands, but after repeated requests by Zhang, Emperor Zhongzong approved.
The forts were completed in 60 days, and Zhang further built scout stations north of Mount Niutouchaona (牛頭朝那山, in modern Baotou).
Apparently also at his suggestion, the ethnically Tufan general Lun Gongren (論弓仁) was made the forward commander of an army that patrolled the Nuozhen River (諾真水, flowing through modern Baotou).
In 710, Emperor Zhongzong died suddenly—a death that traditional historians believed to be poisoning carried out by his powerful wife Empress Wei and daughter Li Guo'er the Princess Anle.