Anas bin Malik reported,

A funeral procession passed by, and the people spoke well of the deceased. The Prophet ﷺ said, "It has become certain."Then another funeral passed by, and the people spoke ill of the deceased. He said, "It has become certain."Umar bin Khattab asked, "What has become certain?"He replied, "This one whom you praised, Paradise has become certain for him, and this one whom you spoke ill of, the Fire has become certain for him. You are Allah's witnesses on earth."

Azami 14657

Sahih

عن أنس بن مالك قال

مروا بجنازة فأثنوا عليها خيرا فقال النبي ﷺ: وجبت ثم مروا بأخرى فأثنوا عليها شرا فقال: وجبت فقال عمر بن الخطاب: ما وجبت؟ قال: هذا أثنيتم عليه خيرا فوجبت له الجنة، وهذا أثنيتم عليه شرا فوجبت له النار، أنتم شهداء الله في الأرض.

الأعظمي 14657صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Superior moral conduct
Chapter
Etiquette of speech, words, and correspondence
Section
Good praise and bad praise
Numbering
Jami al-Kamil 14657 (2nd edition)
Azami 14657