I expect your problem is caused by not initializing details
with something containing a referenceable id
property before the template attempts to access it.
Not that there is any particular reason for you to care about my opinion, but if you do, please see this thread for what I think is a substantially better way of structuring this general idiom.