workflow ecma script even works? | Community
Skip to main content
broman__pl
Level 3
March 23, 2023

workflow ecma script even works?

  • March 23, 2023
  • 1 reply
  • 1088 views

I'm playing with workflows and must say it is terrible experience 😞

From UI all looks good then in logs I see errors about my model.

I've try to just run sample script delivered with AEM and it is not working

Unable to execute rule /libs/workflow/scripts/sample.ecma : Failure running script /libs/workflow/scripts/sample.ecma: ReferenceError: "workItem" is not defined. (NO_SCRIPT_NAME#2)

Now I limited my script just to log some random text

log.info("Workflow Bartek LOG test");

And now error is even more surprising

Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/my-test.ecma: ReferenceError: "check" is not defined. (NO_SCRIPT_NAME#2)

I don't have any "check" in my script and running it as single process. Any idea how to make it work? Should I even spend time on playing with ECMA scripts?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Anmol_Bhardwaj
Community Advisor
Community Advisor
March 24, 2023

Hi @broman__pl ,
Yes, it works. Maybe you missed a step or config.

Please try to go through this answer by @shubham_borole, and check whether you are following the same process or not.
Solved: Custom Step Workflow with Ecma script - Adobe Experience League Community - 416420

broman__pl
Level 3
March 30, 2023

I don't want to create anything custom. It was rather initial test of workflow.

After restart my workflow somehow started working but even if step is super simple logging message

log.info("test");

instead of finishing it is stuck in running state which prevents any next instance on same workflow. There is nothing that could give me a clue why and it is not very reliable as once it is stuck all next same events are ignored.