Change your preferences here.
The user is immediately KOed, then the Pokémon switched in heals all HP, PP, and status. Any events that would occur after the user's turn do so after the new Pokémon is switched in. Entry hazard effects are applied before the Pokémon is healed. If the switched in Pokémon has equal to or less health than that done by entry hazards, the Pokémon will faint and will not be healed.
Healing Wish is an equivalent move, but does not heal PP.