The present invention provides a substituted pyrrolidine compound having an orexin type 2 receptor agonist activity.A compound represented by the formula (I):wherein each symbol is as described in the specification, or a salt thereof, has an orexin type 2 receptor agonist activity, and is useful as an agent for the prophylaxis or treatment of narcolepsy.