How are you feeling now? Were you able to stave off the urges?
Next time you get the urge find something else to do that you like and can lose yourself in. For me that's playing instruments, running, and writing. I agree that you need to figure out something else other than switch up meds every time you get urges. There is chemical imbalances (successfully treated by meds) and developmental imbalances and more often than not self harm urges are more developmental.