Error executing custom script action

The version of RPA that I have is 2.2.3.1153 and I have problems loading some scripts, I need help

error%201

Hi, @Gamaliel can you share your custom script and the full text of the error message (press Details for it)?

ok and with the error i add the message the "clic for more information"of the custom actions script of the action library.
error%201

and the error:

Error executing CustomScriptAction
  com.workfusion.studio.rpa.recorder.playback.PlaybackException: Error executing TemplateAction[templateName=CustomScriptAction.ftl,id=1,name=Optional[CustomScriptAction],parent=-1,arguments=ActionArguments[delay=[0],xsi:type=[recorder:CustomScriptAction, recorder:CustomScriptAction],pollingInterval=[300],active=[true],script=[

				import com.workfusion.studio.rpa.recorder.api.*
				import com.workfusion.studio.rpa.recorder.api.types.*
				import com.workfusion.studio.rpa.recorder.api.custom.*
				import com.workfusion.studio.rpa.recorder.api.internal.representation.*

				import com.workfusion.bot.exception.*


				com.workfusion.rpa.helpers.RPA.metaClass.static.$ = { Closure c -> c.call() } // Support for Expression action. Should be implemented in RPA class in next release.

				enableTypeOnScreen()


				inDesktop {
					sendKeys(StringTransformations.getHotKeyText(114, 4))
				}


				inDesktop {
					sendKeys(StringTransformations.escapeAutoitText("cmd"))
				}


				inDesktop {
					sendKeys(StringTransformations.getKeyPressText(28, 13, 10, 0))
				}
		
	
],awaitTimeout=[5000]]]
      at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
      at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:64)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:152)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: com.workfusion.studio.rpa.recorder.utils.CustomActionNotFoundException: Unable to find custom action definition. Please check if the source correct.
      at com.workfusion.studio.rpa.recorder.utils.CustomScriptActionParser.lambda$extractMethodName$1(CustomScriptActionParser.java:42)
      at java.util.Optional.orElseThrow(Optional.java:290)
      at com.workfusion.studio.rpa.recorder.utils.CustomScriptActionParser.extractMethodName(CustomScriptActionParser.java:42)
      at com.workfusion.studio.rpa.recorder.freemarker.method.ExtractCustomActionNameMethod.exec(ExtractCustomActionNameMethod.java:45)
      at freemarker.core.MethodCall._eval(MethodCall.java:62)
      at freemarker.core.Expression.eval(Expression.java:78)
      at freemarker.core.Assignment.accept(Assignment.java:131)
      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.action.template.TemplateAction.executeBehavior(TemplateAction.java:33)
      at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
      at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:64)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:152)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
      at java.lang.Thread.run(Thread.java:745)

It looks like you have a chunk of code from a bot task in the script.

Custom script should have the following format:

@CustomScriptAction(
    input = [],    // mapping script local variables to Recorder variables
    output =     // return script result and assign to a Recorder variable
)
 
def customScript() {
    // your code goes here
}

You can read more about it in the Knowledge Base: https://kb.workfusion.com/display/RPAe/Script+as+Custom+Action#ScriptasCustomAction-InRPARecorder

And here you can find some examples of custom scripts https://kb.workfusion.com/display/RPAe/Code+Samples

about the message of the next image, i want to know because in a earlier version this message is displayed
the first version is 2.1.3.858
and the message in this version is the next:

but in another pc i have installed the next version: 2.2.3.1153
and i get next message:

1 Like

Thank you @Gamaliel we’ll look into it

@Gamaliel does this happen when you hover on ‘Script’ and click this link?

yes, this happens when I click on that link

Do you have this issue with only this action or all of them?

just in this action.

1 Like

this problem can get of the instalation?

1 Like

@Gamaliel I rechecked the tips in version 2.2.3, and you are correct - the documentation for the Custom Action is missing as the link to it has changed.

It has been updated for version 2.3 and is shown correctly there. So updating to this version will solve the issue.

Before updating, note that there are quite a lot of changes in this version.

what if I just want to throw an custom exception (say - file not found error)?
Could you tell how (example code) and if I have to follow the above format?