Mishkat al-Masabih 3738
‘Ali said:
God's Messenger sent me to the Yemen as qadi and I said, “Messenger of God, are you sending me when I am young and have no knowledge of the duties of qadi He replied, “God will guide your heart and keep your tongue true. When two men bring a case before you do not decide in favour of the first till you hear what the other has to say, for it is best that you should have a clear idea of the best decision." He said he had no doubts about a decision afterwards. 

Tirmidhi, Abu Dawud and Ibn Majah transmitted it.
عَن عَلِيٍّ رَضِيَ اللَّهُ عَنْهُ قَالَ: بَعَثَنِي رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِلَى الْيَمَنِ قَاضِيًا فَقُلْتُ: يَا رَسُولَ اللَّهِ تُرْسِلُنِي وَأَنَا حَدِيثُ السِّنِّ وَلَا عِلْمَ لِي بِالْقَضَاءِ؟ فَقَالَ: «إِنَّ اللَّهَ سَيَهْدِي قَلْبَكَ وَيُثَبِّتُ لِسَانَكَ إِذَا تَقَاضَى إِلَيْكَ رَجُلَانِ فَلَا تَقْضِ لِلْأَوَّلِ حَتَّى تَسْمَعَ كَلَامَ الْآخَرِ فَإِنَّهُ أَحْرَى أَنْ يَتَبَيَّنَ لَكَ الْقَضَاءُ» . قَالَ: فَمَا شَكَكْتُ فِي قَضَاءٍ بَعْدُ. رَوَاهُ التِّرْمِذِيُّ وَأَبُو دَاوُدَ وَابْنُ مَاجَهْ