Yes that's what we've been spending considerable time planning and trying to implement in the simplest/easiest manner possible.
Both Schlage and Yale have two modes of operations:
1. Press the button the keypad and it locks the door (no code required, Schlage calls this lock and leave and Yale calls it One Touch Lock)
2. The user needs to enter the code and then press the button to lock the door
The new Z-Wave Enhanced Lock DH now support both these modes and this smartapp can process both modes. Depending on how you're configured your lock you can correspondingly configure your SmartApp.
If the SmartApp detects from the DH that a code was used to lock it'll look for the user specific routine if configured or fall back to the generic whole app routine for external lock.
If the SmartApp detects that no code was used (One Touch/Lock & Leave) then it looks for the generic whole app routine to run.
Does that help? Is the functionality confusing, we're open to feedback on how to make it easier.
EDIT: I know many folks prefer to use the stock DH but since the stock DH has a few bugs in this area they will need to update to the custom DH to use these features, however we'll work with ST to reverse integrate some of these bug fixes and features back into the stock DH so that the basic functionality of user codes lock and external lock events can be used.