Use a screwdriver to remove the latch and the handles and assess the extent of the damage. If the problem is only with the latch, you only need to replace it, without having to buy a new lock. If it is the lock, ensure you get a compatible replacement. There are two categories of sliding door locks-surface mount locks and mortise lock-surface mount or mortise. You will, therefore, need to know the type of lock before you buy the replacement. The replacement procedure is exactly similar to the method you used when removing the parts.