Ok ... when you sent the W-7 with the federal return once the number was issued the federal return was processed and you were sent a letter with that number on it. You should have used that number to complete the 2017 state return that was waiting for that number. Sounds like you did not if you need to do it now. So... do you still have that very important letter in a safe place ?
If not ...
In order to retrieve a lost ITIN (that is Individual Taxpayer Identification Number), you will need to call the IRS ITIN Hotline at 1-800-908-9982. You can answer a series of questions to verify your identity and the IRS will provide you the number.