Some birds can be effectively potty trained (although not all - it varies from individual bird to individual bird). There's no hard and fast rules to work out whether they can or not - you just have to give it a try and see if it works. That said you'll stand a better chance with larger birds (who can "hold" the poop longer than smaller ones such as budgies) and the younger the better.
Before you begin
Observe your bird for a few days, you should be able to pick up on some behavioral clues that they are about to defecate. Most will have a little mannerism or stance that they do - you just need to work out what your bird's is. You should also be able to pick up on your bird's routine - some will do it at specific times of day or in response to certain events such as eating a meal. Make a note of how long they typically go between defecating.
Train them to defecate in response to a command - you can use a spoken word/phrase or a clicker. If going for a verbal command you want it to be something that a) isn't likely to come up in general conversation and b) you don't mind if your bird picks up to say itself (if your parrot is a talker!).
So when you see the cues you picked up on earlier have the bird "step up" to where you want them to defecate and say the command. Try and keep the intonation of the command as much the same as possible to make it easier to learn - they don't understand the language but instead will be picking up on how it sounds.
Then, when the bird defecates reward it with a treat/fuss/praise - ideally you want to be giving this treat only for defecating on command during training or you risk confusing them and getting some unwanted pooping!
This will take a few repetitions to sink in - how many will depend on the individual bird. But eventually you should be able to get them to defecate on command (rather than on their schedule) Some never get there! Some will learn to defecate on command but won't ever get the additional step of not doing it elsewhere - which obviously wouldn't solve your problem. This is where the time interval we observed earlier came in - if you want to have your parrot on your shoulder you can have them poop on command, then you know that you have a certain amount of time before they need to go again and can take them back to the toilet to do it in advance of them taking matters into their own hands (feathers).
DO NOT Use punishment or reprimands - it doesn't work with birds, and can easily have the opposite to the desired effect and lead to them defecating for attention!