External method code: def get_next_id(ZClass, Folder=None): """Generate a unique sequencial id for the ZClass""" ZClass.next_id = getattr(ZClass, 'next_id', 0) + 1 id = ZClass.getId() + '_' + ZClass.next_id if Folder and id in Folder.objectIds(): id = get_next_id(ZClass, Folder) return id Place the above code in a ".py" file in your Zope extensions directory. Then create an external method "get_next_id" inside Zope in the Root Folder (!) that exposes the method function. Change the following line in the constructor DTML method of your ZClass (ZClass_add): to: Substitute the actual id of your ZClass for "ZClass" in the above line.