We define when a ternary term m of an algebraic language $$\mathcal {L}$$ is called a distributive nearlattice term ( $$\mathrm {DN}$$ -term) of a sentential logic $$\mathcal {S}$$ . Distributive nearlattices are ternary algebras generalising Tarski algebras and distributive lattices. We characterise the selfextensional logics with a $$\mathrm {DN}$$ -term through the interpretation of the DN-term in the algebras of the algebraic counterpart of the logics. We prove that the canonical class of algebras (under the point of view of Abstract Algebraic Logic) associated with a selfextensional logic with a $$\mathrm {DN}$$ -term is a variety, and we obtain that the logic is in fact fully selfextensional.