cancel
Showing results for 
Search instead for 
Did you mean: 

status aspect on workflow

evdgeest
Champ in-the-making
Champ in-the-making
Hi,

I want to arrange that the workflow adds an aspect to the document every time the workflow changes between tasks, so when you view the details of that document you see his status in the workflow.

I added an aspect in the testmodel, and in the process definition I added a script in the transition part of the start-task. I keep on getting the errors below when starting the advanced workflow.

13:20:30,194 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: Failed to execute supplied script: Wrapped java.lang.NullPointerException (AlfrescoScript#1)
org.alfresco.service.cmr.repository.ScriptException: Failed to execute supplied script: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: org.alfresco.error.AlfrescoRuntimeException: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: java.lang.NullPointerException
13:20:30,444 ERROR [org.alfresco.web.ui.common.Utils] A system error happened during the operation: Failed to signal transition 'null' from workflow task 'jbpm$118'
org.alfresco.service.cmr.workflow.WorkflowException: Failed to signal transition 'null' from workflow task 'jbpm$118'

Caused by: org.jbpm.graph.def.DelegationException

Caused by: org.alfresco.service.cmr.repository.ScriptException: Failed to execute supplied script: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: org.alfresco.error.AlfrescoRuntimeException: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (AlfrescoScript#1)

Caused by: java.lang.NullPointerException
testmodel.xml
  <namespaces>
    <namespace uri="test.model" prefix="test"/>
  </namespaces>


  <aspects>
      <!– Aspect: Workflow status –>
      <aspect name="test:Workflow_Status">
        <title>Workflow Status</title>
        <properties>
          <property name="test:BpmNr">
            <title>Workflow ID</title>
            <type>d:text</type>
          </property>
          <property name="test:BpmStatus">
            <title>Workflow status</title>
            <type>d:text</type>
          </property>
        </properties>
      </aspect>

  </aspects>

test_processdefinition.xml
  <start-state name="start">
    <task name="wf:submitBehandelTask" swimlane="initiator"/>
    <transition name="test1" to="script">
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
          <script>
            var props = new Array(1);
            props["test:BpmNr"] = "testnr";
            bpm_package.addAspect ("test:Workflow_Status");

            executionContext.leaveNode();
          </script>
        </action>
    </transition>
  </start-state>

I hope you can tell me what I am doing wrong!

Thanks in advance,

Edwin
3 REPLIES 3

evdgeest
Champ in-the-making
Champ in-the-making
I hope someone knows the answer, because I am really looking forward to it.

Thanks,

Edwin

alexander
Champ in-the-making
Champ in-the-making
I think it should look like this:

bpm_package.children[0].addAspect ("test:Workflow_Status", props);

Also, you might want to add line:
bpm_package.children[0].save()

See if it helps.

PS: not sure if executionContext.leaveNode(); applicable in transition. If transition is executing, leaveNode is probably already triggered…

sradha
Champ on-the-rise
Champ on-the-rise
Hi,

Can we add an aspect value in "review and approve" workflow and fetch its value? Can you please help me?



Regards,
Sradha