How long does negative information affect your credit score?
Seven years, Ten for bankruptcy.
Collections and legal actions such as judgements continually hold the score down during the seven years.

The time to fix a legal action is quickly, except when you are applying for credit. Paying off an old collection actually pulls the score down by making it a current issue.
When a problem shows up during the mortgage process, work with your loan officer for timing. It may be better to leave it alone and agree to pay off the collection as a condition of closing the loan, at escrow.
Note then, the older a negative item is, the less it influences the score.

A colleague wanted to do the right thing so after getting her scores up high enough for refinancing at a better rate, she wanted to complete the process by paying off a small, but old collection account. Big mistake. She watched her credit score plummet overnight because what was an “old debt” (the collection account) became a current bad debt. Now she has to wait the time out once again to raise the scores back up.