Hi,
I am trying to provide an implementation for dynamic participant step
using an ECMA script. The script basically returns a participant user
based on the path of the payload.Here is the script -
function getParticipant() {
var workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().
log.debug("this is the payload path : " + path);
if (path.indexOf("/content/test/
return new String("user-a");
}
else if (path.indexOf("/content/test/
return new String("user-b");
}
else if (path.indexOf("/content/test/
return new String("user-c");
}
else if (path.indexOf("/content/test/
return new String("user-d");
}
else if (path.indexOf("/content/test/
return new String("user-e");
}
}
}
But running this script gives below exception -
25.01.2012 16:41:26.139 *WARN* [127.0.0.1 [1327527685905] POST /etc/
workflow/instances HTTP/1.1]
com.day.cq.workflow.impl.
to get the java object java.lang.
org.mozilla.javascript.
at java.lang.Class.
at
com.day.cq.workflow.impl.
202)
at
com.day.cq.workflow.impl.
156)
at
com.day.cq.workflow.impl.
124)
Any pointers would be greatly appriciated.
Thanks in advance.
Solved! Go to Solution.
hi,
Not sure if this is exactly your issue, but the "new String" part will not work in your script. Remember that this is script, not pure Java. The best thing to do is just return quoted values like "user-a" instead of new String("user-a");
If you want to create a new string with the new operator you should be able to do it with:
new Packages.lang.java.String("user-a");
Will
hi,
Not sure if this is exactly your issue, but the "new String" part will not work in your script. Remember that this is script, not pure Java. The best thing to do is just return quoted values like "user-a" instead of new String("user-a");
If you want to create a new string with the new operator you should be able to do it with:
new Packages.lang.java.String("user-a");
Will
For your example -- did you create it or did you reference it from an article or doc topic?
Views
Replies
Total Likes
Documentation request has been placed to update. For now use like [1] & also make sure to have else block in your code to return default value for unhandled case.
[1] return new Packages.java.lang.String("user-a")
Views
Replies
Total Likes
Hi Will ,
Thanks a lot for checking out my post . I tried returning the quoted values still im getting the same error .
Please check the below script
function getParticipant() { var workflowData = workItem.getWorkflowData(); if (workflowData.getPayloadType() == "JCR_PATH") { var path = workflowData.getPayload().toString(); if (path.indexOf("/content/geometrixx/en") == 0) { return "admin"; } else { return "author"; } } }
The got the above script from the following link
http://helpx.adobe.com/experience-manager/kb/HowToAssignAWorkflowDynamicallyToParticipants.html
Views
Replies
Total Likes
I have created a workflow model where in the admin needs to assign the workflow task to an author . The workflow task has to be assigned to an user based on certain condition dynamically . I tried using the below package from adobe site but still its not working .
http://helpx.adobe.com/experience-manager/kb/HowToAssignAWorkflowDynamicallyToParticipants.html
Views
Replies
Total Likes
Views
Likes
Replies