When the Messenger of Allah ﷺ decided to send Muaz to Yemen, he asked him, "How will you judge when a matter is brought before you?"Muaz replied, "I will judge by the Book of Allah."The Prophet ﷺ asked, "And if you do not find it in the Book of Allah?"Muaz said, "Then by the Sunnah of the Messenger of Allah ﷺ."The Prophet ﷺ asked, "And if you do not find it in the Sunnah of the Messenger of Allah ﷺ nor in the Book of Allah?"Muaz said, "I will exercise my own judgment and spare no effort."The Messenger of Allah ﷺ then struck his chest and said, "Praise be to Allah, who has guided the messenger of the Messenger of Allah to that which pleases the Messenger of Allah."
حدثنا حفص بن عمر عن شعبة عن أبي عون عن الحارث بن عمرو ابن أخي المغيرة بن شعبة عن أناس من أهل حمص من أصحاب
أن رسول الله ﷺ لما أراد أن يبعث معاذا إلى اليمن قال كيف تقضي إذا عرض لك قضاء قال أقضي بكتاب الله قال فإن لم تجد في كتاب الله قال فبسنة رسول الله ﷺ قال فإن لم تجد في سنة رسول الله ﷺ ولا في كتاب الله قال أجتهد رأيي ولا آلو فضرب رسول الله ﷺ صدره وقال الحمد لله الذي وفق رسول رسول الله لما يرضي رسول الله
[Its chain is daif] Tirmidhi narrated it in the Chapters on Rulings, the chapter on how a judge should render judgment, hadith 1327 and 1328, from the hadith of Shubah with this chain, and he said, "In my view its chain is not connected." Harith is majhul (unknown), and Bukhari and the majority declared this hadith daif.