<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Should I get a string in the context variable when I use: Context[&amp;quot;RECIPETYPE&amp;quot;] = &amp;quot;@{Document.type}&amp;quot;; in a script? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314085#M1086</link>
    <description>&lt;P&gt;Did you mean that you add a Execution Context &amp;gt; Set Context Variable operation into you operation chain definition and you set values like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;name: RECIPETYPE&lt;/LI&gt;
&lt;LI&gt;value: @{Document.type}&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Because if you do&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;name: Context["RECIPETYPE"]&lt;/LI&gt;
&lt;LI&gt;value: @{Document.type}&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You ask to automation to get the name where store the document type value into the RECIPETYPE variable.&lt;/P&gt;
&lt;P&gt;Anyway your error is not at all expressing value you set. Did you put something like that in your chain:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@{Fn.getVocabularyLabel("voc", "key")}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is more there.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2012 18:09:31 GMT</pubDate>
    <dc:creator>Benjamin_Jalon1</dc:creator>
    <dc:date>2012-04-10T18:09:31Z</dc:date>
    <item>
      <title>Should I get a string in the context variable when I use: Context["RECIPETYPE"] = "@{Document.type}"; in a script?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314084#M1085</link>
      <description>&lt;P&gt;When I try to set a context variable using: Context["RECIPETYPE"] = "@{Document.type}"; I get the error below.&lt;/P&gt;
&lt;P&gt;If I use Context["RECIPETYPE"] = "ThisIsATestString"; everything downstream from this script line works ok.&lt;/P&gt;
&lt;P&gt;Error log output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;2012-04-09 11:52:03,433 ERROR [org.nuxeo.ecm.automation.core.events.OperationEventListener] Failed to handle event documentCreated using chain: besCreateProcessSkinRecipe
org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Context.SetVar
        at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:144)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:114)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:117)
        at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
        at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:85)
        at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.handleEvent(EventHandlerRegistry.java:198)
        at org.nuxeo.ecm.automation.core.events.PostCommitOperationEventListener.handleEvent(PostCommitOperationEventListener.java:46)
        at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$Job.run(AsyncEventExecutor.java:160)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)
Caused by: [Error: cannot invoke method: getVocabularyLabel]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
        at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:63)
        at org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:38)
        at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:66)
        at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:96)
        at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:41)
        at org.mvel2.MVEL.executeExpression(MVEL.java:1053)
        at org.nuxeo.ecm.automation.core.scripting.MvelExpression.eval(MvelExpression.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)
        ... 25 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
        ... 35 more
Caused by: java.lang.NullPointerException
        at org.nuxeo.ecm.automation.features.PlatformFunctions.getVocabularyLabel(PlatformFunctions.java:63)
        ... 40 more
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2012 17:46:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314084#M1085</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-09T17:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Should I get a string in the context variable when I use: Context["RECIPETYPE"] = "@{Document.type}"; in a script?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314085#M1086</link>
      <description>&lt;P&gt;Did you mean that you add a Execution Context &amp;gt; Set Context Variable operation into you operation chain definition and you set values like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;name: RECIPETYPE&lt;/LI&gt;
&lt;LI&gt;value: @{Document.type}&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Because if you do&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;name: Context["RECIPETYPE"]&lt;/LI&gt;
&lt;LI&gt;value: @{Document.type}&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You ask to automation to get the name where store the document type value into the RECIPETYPE variable.&lt;/P&gt;
&lt;P&gt;Anyway your error is not at all expressing value you set. Did you put something like that in your chain:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@{Fn.getVocabularyLabel("voc", "key")}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is more there.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 18:09:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314085#M1086</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-04-10T18:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Should I get a string in the context variable when I use: Context["RECIPETYPE"] = "@{Document.type}"; in a script?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314086#M1087</link>
      <description>&lt;P&gt;I originally tried your first example and it didnt' work. Got the error log listed.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 21:32:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/should-i-get-a-string-in-the-context-variable-when-i-use-context/m-p/314086#M1087</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-10T21:32:26Z</dc:date>
    </item>
  </channel>
</rss>

