The medication , commonly known as Viagra, is a prescription treatment primarily used to treat erectile dysfunction in males . Developed initially for heart conditions , its surprising side effects relating to vasodilation led to its subsequent use as an effective solution for sexual dysfunction . It works by increasing blood flow to the male organ