Issue while exporting code into Bot Task

Hi,
I am getting an error while performing ‘Export code to bot task’ action.
I am getting below error.

Recorder script code export failed.
Unable to process template with name: ExpressionValueAction.ftl

Even I tried for “Export code to Groovy script”, it is giving following error.

Unable to process template with name: ExpressionValueAction.ftl
Unable to process template with name: ExpressionValueAction.ftl
  java.lang.IllegalStateException: Unable to process template with name: ExpressionValueAction.ftl
  		at com.workfusion.studio.rpa.recorder.freemarker.FreemarkerTemplateProcessor.process(FreemarkerTemplateProcessor.java:95)
  		at com.workfusion.studio.rpa.recorder.playback.ActionTemplate.process(ActionTemplate.java:41)
  		at com.workfusion.studio.rpa.recorder.playback.ActionTemplate.process(ActionTemplate.java:25)
  		at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.toScriptCode(TemplateAction.java:43)
  		at com.workfusion.studio.rpa.recorder.playback.RootAction.lambda$toScriptCode$1(RootAction.java:115)
  		at java.util.ArrayList.forEach(ArrayList.java:1249)
  		at com.workfusion.studio.rpa.recorder.playback.RootAction.toScriptCode(RootAction.java:115)
  		at com.workfusion.studio.recorder.editor.action.ExportToGroovyScriptAction.getScriptContent(ExportToGroovyScriptAction.java:69)
  		at com.workfusion.studio.recorder.editor.action.ExportToGroovyScriptAction.run(ExportToGroovyScriptAction.java:40)
  		at com.workfusion.studio.recorder.editor.action.RecorderAction.run(RecorderAction.java:28)
  		at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
  		at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
  		at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
  		at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
  		at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4118)
  		at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
  		at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
  		at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3534)
  		at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
  		at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  		at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
  		at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
  		at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
  		at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  		at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
  		at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
  		at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
  		at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  		at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
  		at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  		at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
  		at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
  		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  		at java.lang.reflect.Method.invoke(Method.java:498)
  		at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
  		at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
  		at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
  		at org.eclipse.equinox.launcher.Main.main(Main.java:1471)
  caused by freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> recorder_variable_types[varName]  [in template "ExpressionValueAction.ftl" at line 3, column 10]

----
Tip: It's the final [] step that caused this error, not those before it.
----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #if recorder_variable_types[varName] ...  [in template "ExpressionValueAction.ftl" at line 3, column 5]
----
  		at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131)
  		at freemarker.core.EvalUtil.compare(EvalUtil.java:195)
  		at freemarker.core.EvalUtil.compare(EvalUtil.java:112)
  		at freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:64)
  		at freemarker.core.AndExpression.evalToBoolean(AndExpression.java:32)
  		at freemarker.core.IfBlock.accept(IfBlock.java:46)
  		at freemarker.core.Environment.visitByHiddingParent(Environment.java:345)
  		at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48)
  		at freemarker.core.Environment.visit(Environment.java:324)
  		at freemarker.core.MixedContent.accept(MixedContent.java:54)
  		at freemarker.core.Environment.visit(Environment.java:324)
  		at freemarker.core.Environment.process(Environment.java:302)
  		at freemarker.template.Template.process(Template.java:325)
  		at com.workfusion.studio.rpa.recorder.freemarker.FreemarkerTemplateProcessor.process(FreemarkerTemplateProcessor.java:84)
  		at com.workfusion.studio.rpa.recorder.playback.ActionTemplate.process(ActionTemplate.java:41)
  		at com.workfusion.studio.rpa.recorder.playback.ActionTemplate.process(ActionTemplate.java:25)
  		at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.toScriptCode(TemplateAction.java:43)
  		at com.workfusion.studio.rpa.recorder.playback.RootAction.lambda$toScriptCode$1(RootAction.java:115)
  		at java.util.ArrayList.forEach(ArrayList.java:1249)
  		at com.workfusion.studio.rpa.recorder.playback.RootAction.toScriptCode(RootAction.java:115)
  		at com.workfusion.studio.recorder.editor.action.ExportToGroovyScriptAction.getScriptContent(ExportToGroovyScriptAction.java:69)
  		at com.workfusion.studio.recorder.editor.action.ExportToGroovyScriptAction.run(ExportToGroovyScriptAction.java:40)
  		at com.workfusion.studio.recorder.editor.action.RecorderAction.run(RecorderAction.java:28)
  		at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
  		at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
  		at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
  		at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
  		at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4118)
  		at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
  		at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
  		at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3534)
  		at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
  		at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  		at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
  		at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
  		at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
  		at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  		at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
  		at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
  		at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
  		at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  		at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
  		at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  		at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
  		at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
  		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  		at java.lang.reflect.Method.invoke(Method.java:498)
  		at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
  		at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
  		at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
  		at org.eclipse.equinox.launcher.Main.main(Main.java:1471)

Thanks,
Pritee

Hello Pritee.
Does the exception occur in the latest version 2.2.2?

It is 2.2.0

But I have installed latest version in the last week only. Do I need to again download it and install it? It takes so much time for installing.

Thank you. From this exception it looks like something is wrong with “Expression value” action in your actions flow. Could you please check from your side? I cannot reproduce this issue in 2.2.2 version.

I have one use case where it reads data from Excel and send mail one by one. So I have 2 bots, one for reading excel and other for sending mail.
I have created one variable in first bot and it checks for one condition. In second bot, I have incremented that variable using expression value.
When I am creating Bot task it fails, may be problem is of not creating that variable in second bot.
So what will be the solution for this.

Is it possible to send your .rpae files for both tasks? You need to remove all sensitive information before sending. We will investigate them.

Hello @pbhandari.
Is this still actual? If yes, could you please send .rpae files for both tasks?

I have resolved this issue by incrementing variable into first bot.

2 Likes