I might have to wean and idk what to do

So I saw my doctor today and it looks like I might need to start a medication that I can’t take while breastfeeding. Well my plan was to BF for a year (currently 7 months pp) so I have not really tried sleep training and he’s been nursing to sleep exclusively. I know myself and know I could not do CIO so I do not know what to do. What do other mamas do to get baby to sleep when they don’t nurse. I’ve thought about rocking him to sleep but he just screams until he gets the boob. Any ideas 😭