Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to show a custom dialog in EMCA ?

Avatar

Level 4

Hi,

I am trying to call a custom dialog in ECMA workflow step. I am getting the following error.

Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /etc/workflow/scripts/clientlibs/test/customworkflow.ecma: ReferenceError: "CQ" is not defined. (/etc/workflow/scripts/clientlibs/test/customworkflow.ecma#21)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:193)
    ... 5 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "CQ" is not defined. (/etc/workflow/scripts/clientlibs/test/customworkflow.ecma#21)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
    at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
    at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)
    at org.mozilla.javascript.gen.c25._c0(/etc/workflow/scripts/clientlibs/test/customworkflow.ecma:21)
    at org.mozilla.javascript.gen.c25.call(/etc/workflow/scripts/clientlibs/test/customworkflow.ecma)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
    at org.mozilla.javascript.gen.c25.call(/etc/workflow/scripts/clientlibs/test/customworkflow.ecma)
    at org.mozilla.javascript.gen.c25.exec(/etc/workflow/scripts/clientlibs/test/customworkflow.ecma)
    at org.mozilla.javascript.Context.evaluateReader(Context.java:1227)
    at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java:114)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
    ... 7 more


Please tell me how to get the CQ object in ecma script to show or hide custom dialog.

Thanks in advance.

Vikram.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

Not sure what you're trying to do exactly, this sounds a bit confused.  If you want to use a custom dialog for a step in a workflow you must use the Dialog Participant Step.  Or perhaps you're trying to execute an ecma script as a step in a workflow - when you do this there is no CQ object defined.  

See here for what is provided to you by the workflow engine when you script is executed as a workflow step [0].  If you want to create a dialog for a participant step see here [1].

Hope this helps,

Will

[0] http://docs.adobe.com/docs/en/cq/5-6-1/workflows/wf-extending.html#Developing Process Step Implementations --> "Implementing a Process Step with an ECMA Script"

[1] http://docs.adobe.com/docs/en/cq/5-6-1/workflows/wf-ref.html#Dialog Participant Step

View solution in original post

3 Replies

Avatar

Level 10

Read the CQ documentaton located here:

http://docs.adobe.com/docs/en/cq/5-6-1/workflows/wf-extending.html#Accessing Dialog Property Values at Runtime

IN this doc topic - there is mention of ECMA. However - i am not seeing mention of a custom dialog. I will ask eng team to help here. 

Avatar

Level 4

Hi Scott,

Thanks for your reply.

I am also referring the same page for ECMA scripts.

If you could get me help from eng team that will be really helpful.

Thanks.

Vikram.

Avatar

Correct answer by
Employee

Hi,

Not sure what you're trying to do exactly, this sounds a bit confused.  If you want to use a custom dialog for a step in a workflow you must use the Dialog Participant Step.  Or perhaps you're trying to execute an ecma script as a step in a workflow - when you do this there is no CQ object defined.  

See here for what is provided to you by the workflow engine when you script is executed as a workflow step [0].  If you want to create a dialog for a participant step see here [1].

Hope this helps,

Will

[0] http://docs.adobe.com/docs/en/cq/5-6-1/workflows/wf-extending.html#Developing Process Step Implementations --> "Implementing a Process Step with an ECMA Script"

[1] http://docs.adobe.com/docs/en/cq/5-6-1/workflows/wf-ref.html#Dialog Participant Step