The authors of Berg et al. [J. Algebra, 348 (2011) 446–461] provide an algorithm for finding a complete system of primitive orthogonal idempotents for $\mathbb{C}\mathcal{M}$, where $\mathcal{M}$ is any finite $\mathcal{R}$-trivial monoid. Their method relies on a technical result stating that $\mathcal{R}$-trivial monoid are equivalent to so-called weakly ordered monoids. We provide an alternative algorithm, based only on the simple observation that an $\mathcal{R}$-trivial monoid may be realized by upper triangular matrices. This approach is inspired by results in the field of coupled cell network dynamical systems, where $\mathcal{L}$-trivial monoids (the opposite notion) correspond to so-called feed-forward networks. We first show that our algorithm works for $\mathbb{Z}\mathcal{M}$, after which we prove that it also works for $R\mathcal{M}$ where $R$ is an arbitrary ring with a known complete system of primitive orthogonal idempotents. In particular, our algorithm works if $R$ is any field. In this respect our result constitutes a considerable generalization of the results in Berg et al. [J. Algebra, 348 (2011) 446–461]. Moreover, the system of idempotents for $R\mathcal{M}$ is obtained from the one our algorithm yields for $\mathbb{Z}\mathcal{M}$ in a straightforward manner. In other words, for any finite $\mathcal{R}$-trivial monoid M our algorithm only has to be performed for $\mathbb{Z}\mathcal{M}$, after which a system of idempotents follows for any ring with a given system of idempotents.