Current microflow name and backtrace as variable available - Mendix Forum

Current microflow name and backtrace as variable available

38

When you create some generic function, you might want to do some logging in case of an error. It would be handy if you have always available the following:

$callerMicroflowName
$currentMicroflowName
$microflowBacktrace

So you know the microflow that invokes this function or you have the complete backtrace from where the requests originates from. For now I have created a Java action, but it would be handy if this was in the platform.

 

 

asked
5 answers

Nice, currently using Java actions but having it as variables saves time.

Created

You can use some of the Runtime API stuff for this maybe

 

var actionStack=ctx.getContext().getActionStack();
for(var i=0;i<actionStack.length;i++){
    try{
        com.mendix.core.Core.getLogger(ctx.toString()).info(actionStack[i].getActionName().toString());
    }catch(e){
        com.mendix.core.Core.getLogger(root.toString()).info(e.toString());
    }
}

Delivering e.g.

./
└─Nashorn.ivk_Editor_CMD_exec
  └─Nashorn.ivk_exec
    └─Unnamed-Action-6152

 

Created

+1 Vote, please make this happen

Created

+1 Vote from me, I just ran into the same thing. I want to log the name of the microflow being executed. 

Created

Great idea - this is also very handy in case that the name of a microflow is changed.

Created