Getting into a Cog building in Toontown is straightforward when the timing is right. If the elevator to the building is open, you can simply hop on in.
It's a good idea to have a couple of other Toons with you, since a group makes the run easier. You can bring up to four Toons in total.
If you're not a member, you can still take on Cog buildings in Toontown Central, though they tend to be rarer there. Keep an eye out and jump in when one appears.