# currentcontroller is not defined

**URL:** <https://forum.servoy.com/t/currentcontroller-is-not-defined/13803>\
**Category:** Classic Servoy\
**Created:** [March 31, 2011, 2:25pm UTC](https://forum.servoy.com/t/currentcontroller-is-not-defined/13803 "2011-03-31T14:25:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![danny.richadson](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@danny.richadson](https://forum.servoy.com/u/danny.richadson)\
**Post date:** [March 31, 2011, 2:25pm UTC](https://forum.servoy.com/t/currentcontroller-is-not-defined/13803/1 "2011-03-31T14:25:23Z")

</div>

when starting Servoy (5.2.6) i get an exception “currentcontroller” is not defined. the code is below

function \_aytutl\_formHierarchyCall() {  
var $currentFormName = currentcontroller.getName()  
}

It looks like when starting servoy some context is not properly initialized. I can write an try/catch on every currentcontroller but that is not a good alternative.

Regards,

Danny Richardson

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [March 31, 2011, 2:39pm UTC](https://forum.servoy.com/t/currentcontroller-is-not-defined/13803/2 "2011-03-31T14:39:29Z")

</div>

that is a global method?  
how is that global method called?  
Do you have a full stackstacktrace (a java stacktrace besides the js one)?
