Event Handlers/Action Chains triggered on new document contained in folder vs workspace!?

I have at least three different (using a similar configuration pattern) Event/Handler/Action Chain pairs working to fill out fields in newly created folders and documents extended from folders.

I cannot get a similar Event Handler/Action Chain pair working when creating a document in a workspace.

Are there any subtle differences with respect to Event Handlers/Action Chains between folders and workspaces that I should be addressing?

The symptom is the document context,created in the workspace, is not passed to the action chain when the chain is fired so I can't manipulate the field entries. The action chain is a carbon copy of the one working on folders. The chain does fire, the context is not available.

Hope this example clears up what I'm trying to do.

Action Chain Example: (Content view query):

ecm:mixinType != 'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'delete' AND ecm:isProxy = 1 AND ecm:primaryType = 'ZCtrlDocument'

I get a single document from this query. Yes, it's in a section and published. I just want to read some of the meta data first then put that data into the document being created.

Here's the test action chain that's fired from my User Action:

FETCH -> UI SELECTION USER INTERFACE -> ADD INFO MESSAGE value: expr:@{Document[“dc:title”]}

that's it!

I get the following:

Caused by: [Error: could not access: Document; in class: null]
[Near : {... Unknown ....}]
[Line: 1, Column: 0]
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:595)
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionProperty(ReflectiveAccessorOptimizer.java:609)
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:317)
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:137)
        at org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:63)
        at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:137)
        at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:41)
        at org.mvel2.MVEL.executeExpression(MVEL.java:1001)
        at org.mvel2.templates.res.CompiledTerminalExpressionNode.eval(CompiledTerminalExpressionNode.java:56)
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:235)
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:230)
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:220)
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:164)
        at org.nuxeo.ecm.automation.core.scripting.MvelTemplate.eval(MvelTemplate.java:38)
        at org.nuxeo.ecm.automation.core.impl.OperationTypeImpl.inject(OperationTypeImpl.java:158)
        at org.nuxeo.ecm.automation.core.impl.OperationTypeImpl.newInstance(OperationTypeImpl.java:149)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:114)
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:132)
        ... 112 more
0 votes

1 answers



Can you please be a bit more precise of your chain/Event handler configuration. You can just edit your question this will be more readable.

I just copy what Alain told me to copy here :)

Actually, I think that your null pointer exception is for the object “Document”. What you should do is, just after the Fetch Selected Documents, to run an Execution Flow > Run Document Chain. The reason is that the “Document” object is not available when the input is “Documents”.

You can see a sample of this at the page 99 on the following slides

A stacktrace would help to make sure of what is null.

Hope this answer will help you.

0 votes

Duh, sorry for having to repeat the answer.

I will try this on the action chains and post what happens.

Again, thanks for your patience.



No problem, this is just because I'm not expert as Alain is:)

any update ?