I crate trained.
They won’t go where they sleep!
I was able to work from home, keep him in the crate next to me while I worked. Every 2 hours we’d take a 10 min break, go outside & let him smell & he’d usually go.
When he goes, praise, praise, praise!
If he starts to go inside, scoop him up and calmly say, no, no, wait, no, outside.
When outside, say ok, good boy!
That cycle of consistently every 2hours, really set the stage. Eventually I eliminated the crate during the day.
It helped that I had another dog, helping teach.
He was psycho about doing his #2 in the dirt. When we travelled, that was a funny challenge. He eventually outgrew that.
Thanks for the question; it brings back great memories!
Good luck!