  Recent studies show that $D_{s0}^{\ast}(2317)$ and $D_{s1}(2460)$ contain
large molecular components. In this work, we employ the naive factorization
approach to calculate the production rates of $D_{s0}^{\ast}(2317)$ and
$D_{s1}(2460)$ as hadronic molecules in $B_{(s)}$ and $\Lambda_b(\Xi_b)$
decays, where their decay constants are estimated in the effective Lagrangian
approach. With the so-obtained decay constants $f_{D_{s0}^{\ast}(2317)}$ and
$f_{D_{s1}(2460)}$, we calculate the branching fractions of the $b$-meson
decays $B_{(s)}\to \bar{D}_{(s)}^{(*)}D_{s0}^*$ and $B_{(s)}\to
\bar{D}_{(s)}^{(*)}D_{s1}$ and the $b$-baryon decays $\Lambda_b(\Xi_{b}) \to
\Lambda_c(\Xi_{c}) D_{s0}^*$ and $\Lambda_b(\Xi_{b}) \to \Lambda_c(\Xi_c)
D_{s1}$. Our results show that the production rates of $D_{s0}^{\ast}(2317)$
and $D_{s1}(2460)$ in the $B_s$, $\Lambda_b$ and $\Xi_b$ decays are rather
large that future experiments could observe them. In particular, we demonstrate
that one can extract the decay constants of hadronic molecules via the triangle
mechanism because of the equivalence of the triangle mechanism to the tree
diagram established in calculating the decays $B \to
\bar{D}^{(*)}D_{s0}^{\ast}(2317)$ and $B \to \bar{D}^{(*)}D_{s1}(2460)$.
