Unable to Set Context variables..

I have an automation chain that

  • gets a value from a document,
  • sets the context variable,
  • pushes it onto the stack,
  • uses nxql to query a document based on the context variable,
  • sets another context variable with a value from the queried document,
  • pops the previous document
  • and then uses all of that to send an email template. (A classic lookup operation)..

When I hard code my “values” everything works as expected. When I attempt to set a context variable, it fails.

The automation chain is as follows:

alt text

Each time I attempt to get a value, it fails with the following entry in the log:

ERROR [org.nuxeo.ecm.automation.core.events.OperationEventListener] Failed to handle event documentModified using chain: submitFOIAtoAgency
org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Context.SetVar
*and*
Caused by: [Error: org.nuxeo.ecm.core.api.impl.DocumentModelImpl cannot be cast to java.lang.Class]
[Near : {... Unknown ....}]

The automation chain is being kicked off by a document Create or Edit event handler.

I have further refined my issue:

during the Fetch->Query operation I use the context variable as a parameter in my NXQL..

  1. I can run the query with the expected values and it returns a document
  2. I can run the query with a hard coded parameter and it doesn't fail.
  3. I can run the NXQL with SELECT * FROM Document WHERE GOVAGENCY:agency_id = '+@{Context[“agencyid”]}+' and it gives no complaints or failures (I have HAD queries fail before)

The context variable setting fails due to null document (from the Fetch operation I presume)

ERROR [org.nuxeo.ecm.automation.core.events.OperationEventListener] Failed to handle event documentModified using chain: submitFOIAtoAgency org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Context.SetVar

Caused by: [Error: could not access: Document; in class: null] [Near : {… Unknown ….}]

The value for the context setting is:

@{Document[“GOVAGENCY:agency_foia_poc_email”]} - which is a value in the document returned by the query (or at least it is supposed to)

UPDATE:2/1/12

I have everything figured out except for the Fetch returning null document. If I run a query in Advanced Search it returns a document in the environment. If I take the same NXQL query (with the hard coded parameters) and put it into the Fetch->Query operation, it gives me the null document.

Don

0 votes

0 answers

4572 views

ANSWER

Can you give us the value you put into the operation set Context Variable, please ? You can put it directly into your question…
01/28/2012

Can you give us value set into your operations. And if your parameter refer to a specific field can you give the type you choose for this field and also the widget used into the creation/edit tab. I'm waiting something like:

  • gets a value from a document, sets the context variable, (name = agencyid, value = prefix:value => type - List of String, widget : suggestion from groups
  • pushes it onto the stack (no parameter)
  • etc…
01/30/2012

Why do you have + in your request parameter '+@{Context["agencyid"]}+'?
03/19/2012

still open ?
03/30/2012