cancel
Showing results for 
Search instead for 
Did you mean: 

Document.Update operation is failing on using Automation Script

surya_nagaraj
Champ on-the-rise
Champ on-the-rise

Hi, I am trying to update a document property with some value using Automation Scripting, Failed to invoke operations "Document.Update". Also ctx.CurrentDate is returning "null". Please suggest if any configuration/code missing.

Below is code snippet: /Input type:document, OutPut type: void/ function run(input, params) { var docStatus = input.getProperty("doc:doc_status"); WebUI.AddMessage( input, { /required:true - type: string/ 'message': "docstatus "+docStatus+" Date:"+ctx.CurrentDate, /required:true - type: string/ 'severity': "INFO" } );

if(dosStatus == "archived"){

Document.Update(

input, { /required:true - type: properties/ 'properties': {"dc:description": docStatus}, /required:false - type: boolean/ 'save': true } ); }

}

Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Document.Update at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:189) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:130) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:116) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:210) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:117) at org.nuxeo.automation.scripting.internals.AutomationMapper.executeOperation(AutomationMapper.java:60) at jdk.nashorn.internal.scripts.Script$Recompilation$4$1469AA$^eval_.Update(:42) at jdk.nashorn.internal.scripts.Script$Recompilation$2$28AA$^eval_.run(:15) at org.nuxeo.automation.scripting.internals.operation.ScriptingOperationInterface$$NashornJavaAdapter.run(Unknown Source) at org.nuxeo.automation.scripting.internals.operation.ScriptingOperationImpl.run(ScriptingOperationImpl.java:67) at sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:171) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:177) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:130) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:116) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:133) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:116) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:210) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:93) at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.handleEvent(EventHandlerRegistry.java:132) at org.nuxeo.ecm.automation.core.events.OperationEventListener.handleEvent(OperationEventListener.java:40) at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:200) at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:272) at org.nuxeo.ecm.core.api.AbstractSession.saveDocument(AbstractSession.java:1517) at org.nuxeo.ecm.automation.core.operations.document.UpdateDocument.run(UpdateDocument.java:68) at sun.reflect.GeneratedMethodAccessor366.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:171) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:177) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:130) at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:116) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:210) at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:117) at org.nuxeo.automation.scripting.internals.AutomationMapper.executeOperation(AutomationMapper.java:60) at jdk.nashorn.internal.scripts.Script$Recompilation$4$1469AA$^eval_.Update(:42) at jdk.nashorn.internal.scripts.Script$Recompilation$2$28AA$^eval_.run(:15) at org.nuxeo.automation.scripting.internals.operation.ScriptingOperationInterface$$NashornJavaAdapter.run(Unknown Source) at org.nuxeo.automation.scripting.internals.operation.ScriptingOperationImpl.run(ScriptingOperationImpl.java:67) at sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:171) at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:177)

0 REPLIES 0