The medication , commonly known as Viagra, is a prescription treatment mainly used to treat erectile dysfunction in men . Developed initially for heart conditions , its surprising side effects relating to vasodilation led to its new application as an effective solution for sexual health issues .