error: Failed to execute supplied script: missing ), trying to run an script on a user task
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2013 08:40 PM
Hello everybody, I´m kind of new in the alfresco's world. i´m customizing a workflow and I need that when the workflow ends, an aspect is added to the documents in the current workflow, until now I have not reach that point, due to the script I´m using, it's giving me the following error message:
<blockcode>
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 07100442 Failed to execute supplied script: missing ) after condition (AlfrescoJS#4)
</blockcode>
in the alfresco log there is no error, it just the error that shows in the pop up alert.
everything works fine until I put this code…specifically from the "if (${estwf_reviewOutcome} == 'Aprovado'){" part:
<blockcode>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('estwf_reviewOutcome', task.getVariable('estwf_reviewOutcome'));
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
if (${estwf_reviewOutcome} == 'Aprovado'){
if ((bpm_package != null) && (bpm_package.children != null)) {
var i = 0;
for (i = 0; i < bpm_package.children.length; i++) {
var document = bpm_package.children;
document.addAspect("wf:workflowOutcomeAspect");
document.properties["wf:workflowOutcome"] = "approved";
document.save();
}
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</blockcode>
can anyone see what is wrong with this code? or how can I improve it?
Regards, Carolina
<blockcode>
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 07100442 Failed to execute supplied script: missing ) after condition (AlfrescoJS#4)
</blockcode>
in the alfresco log there is no error, it just the error that shows in the pop up alert.
everything works fine until I put this code…specifically from the "if (${estwf_reviewOutcome} == 'Aprovado'){" part:
<blockcode>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('estwf_reviewOutcome', task.getVariable('estwf_reviewOutcome'));
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
if (${estwf_reviewOutcome} == 'Aprovado'){
if ((bpm_package != null) && (bpm_package.children != null)) {
var i = 0;
for (i = 0; i < bpm_package.children.length; i++) {
var document = bpm_package.children;
document.addAspect("wf:workflowOutcomeAspect");
document.properties["wf:workflowOutcome"] = "approved";
document.save();
}
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</blockcode>
can anyone see what is wrong with this code? or how can I improve it?
Regards, Carolina
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2013 05:37 AM
You seem to be using a sort of freemarker mark up on line 4. I suspect
should be
Good luck
Bob Johnson
if (${estwf_reviewOutcome} == 'Aprovado'){
should be
if (estwf_reviewOutcome == 'Aprovado'){
Good luck
Bob Johnson
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2013 06:05 PM
Thanks Bob!!, it works in a certain way, after the change, a new error appeard:
<blockcode>
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 07110148 Failed to execute supplied script: 07110147 ReferenceError: "estwf_reviewOutcome" is not defined. (AlfrescoJS#4)
</blockcode>
so I change the code to this:
<blockcode>
if (task.getVariable('estwf_reviewOutcome') == 'Aprovado'){
</blockcode>
and it works!
Regards, Carolina.
<blockcode>
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 07110148 Failed to execute supplied script: 07110147 ReferenceError: "estwf_reviewOutcome" is not defined. (AlfrescoJS#4)
</blockcode>
so I change the code to this:
<blockcode>
if (task.getVariable('estwf_reviewOutcome') == 'Aprovado'){
</blockcode>
and it works!
Regards, Carolina.
