As said above, quality time with no job and proximity is required. In addition to that, the normal rules for egg laying animals probably apply:
Females kept from nest boxes for too long rush to them to lay their eggs. There is no time for fertilization at that stage, which usually means the first batch of eggs laid are infertile (using DFHack to if eggs are fertilized or not makes things a lot easier).
With animals I just keep the male and the female locked up together with then nest box well in advance of the next egg laying time. You may consider locking the pair up for a dual egg laying cycle (with the first one being dud), or try to time it.
I haven't tried to lock a male and a female up and THEN construct a nest box. With luck, it would allow the female to be impregnated when the box arrives and the egg laying urge overtakes her, but I don't know how egg fertilization works. If it does work, however, it could allow you to skip the dud egg clutch.
By the way, you only need to keep the couple locked in initially if you've burrowed them together. Once they accept the burrow (which can take quite a few attempts due to need satisfaction override and "running away after a job before trying to get a new one"), they'll stay inside even if you unlock the doors (to e.g. allow someone else to install a nest box. Just make sure neither one of the future parents has the appropriate job assigned, or you risk cancellation spam as they can't pick up the nest box, but still take the job so nobody else can do it).