You wanted an answer as to why the routine didn’t work? That’s in the official support article linked to above. The official integration prohibits security devices in routines.
Or you wanted an answer as to how to make a routine accessible from Echo when it has a lock in it?
For that, see the following FAQ. It’s just a trick. A routine can be executed based on a switch turning on. So you create a virtual switch which triggers your routine, , you turn that on with echo, and. Now you can have a routine with any devices you want.
Details are in the FAQ (the topic title is a clickable link)