cancel
Showing results for 
Search instead for 
Did you mean: 

problem with my code

cjimenez1
Champ in-the-making
Champ in-the-making
can you find any problem with my code? because I cannot and I stressed

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">

<process id="ProcesoPublicar" name="Review And Approve Activiti Process">

    <startEvent id="eventoInicio" name="Inicio" activiti:formKey="ak:InicioPublicacion"></startEvent>

    <userTask id="tarea1" name="Tarea Revisar" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="ak:tareaRevisar">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('ak_reviewOutcome', task.getVariable('ak_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
      execution.setVariable('ak_mail1', initiator.properties.email);
      execution.setVariable('ak_mail2', bpm_assignee.properties.email);
</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>

    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="eventoInicio" targetRef="tarea1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" name="" sourceRef="tarea1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow8" name="" sourceRef="exclusivegateway1" targetRef="endevent1">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>
      var mail = actions.create("mail");
      mail.parameters.to = ak_mail1;
      mail.parameters.subject = "Estado de la Publicacion";
      mail.parameters.from = ak_mail2;
      mail.parameters.text = "Lo sentimos, pero su articulo no fue aprobado";
      mail.execute(bpm_package);
      </activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${ak_reviewOutcome == 'Rechazar'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="tarea2" name="Tarea Publicar" activiti:assignee="${ak_publicador.properties.userName}" activiti:formKey="ak:tareaPublicar">
    </userTask>
    <sequenceFlow id="flow9" name="" sourceRef="exclusivegateway1" targetRef="tarea2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${ak_reviewOutcome == 'Aprobar'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow10" name="" sourceRef="tarea2" targetRef="endevent1">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>
      var mail = actions.create("mail");
      mail.parameters.to = ak_mail1;
      mail.parameters.to_many =  ak_mail2;
      mail.parameters.from = ak_publicador.properties.mail;
      mail.parameters.subject = "Estado de la Publicacion";
      if(ak_estadoPublicacion == 'Publicar')
      {
         mail.parameters.text = "Su articulo fue publicado";
      }
      else
      {
         mail.parameters.text = "Su articulo no ha sido publicado";
      }
      mail.execute(bpm_package);
        </activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
  </process>

  <bpmndi:BPMNDiagram id="BPMNDiagram_ProcesoPublicar">
    <bpmndi:BPMNPlane bpmnElement="ProcesoPublicar" id="BPMNPlane_ProcesoPublicar">
      <bpmndi:BPMNShape bpmnElement="eventoInicio" id="BPMNShape_eventoInicio">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="tarea1" id="BPMNShape_tarea1">
        <omgdc:Bounds height="55" width="105" x="125" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="670" y="290"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="285" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="tarea2" id="BPMNShape_tarea2">
        <omgdc:Bounds height="55" width="105" x="400" y="100"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="125" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="230" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="285" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="305" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="305" y="307"></omgdi:waypoint>
        <omgdi:waypoint x="670" y="307"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="305" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="305" y="127"></omgdi:waypoint>
        <omgdi:waypoint x="400" y="127"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="505" y="127"></omgdi:waypoint>
        <omgdi:waypoint x="687" y="127"></omgdi:waypoint>
        <omgdi:waypoint x="687" y="290"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

That's very little explanation for us to look for a problem. Please describe your problem in a lot more detail.
I see that you are using the Alfresco template. Did you deploy this process to the Alfresco process engine?

Best regards,

cjimenez1
Champ in-the-making
Champ in-the-making
Hi,

That's very little explanation for us to look for a problem. Please describe your problem in a lot more detail.
I see that you are using the Alfresco template. Did you deploy this process to the Alfresco process engine?

Best regards,

ok sorry… and it is correct Im using Alfresco process engine…I'll describe you my problem… I need to have two bpm_assignee because in one task I'll have one and in second task other… so I created ak_publicador such as cmSmiley Tongueerson hoping It work but when I try to create the second task I got next error
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:472)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:190)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:282)
        at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
        at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:981)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'ak_publicador'
        at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
        at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
        at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
        at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)