Write date field property in Automation Chain
Hi,
I would like to write date entry to a multi-valued complex field in an automation
Unfortunately my POST request leads to errors when I use @{org.nuxeo.ecm.core.schema.utils.DateParser.formatW3CDateTime(CurrentDate.date)} as suggested in the API playground:
POST /nuxeo/site/automation/Document.Update HTTP/1.1
HOST: localhost:8080
x-authentication-token: xxx
x-nxrepository: default
x-nxproperties: *
x-nxvoidoperation: false
content-type: application/json+nxrequest
cookie: X-Authentication-Token=xxx
content-length: 265
{"params":{"properties":"approval:approval/approval_a_typ=2\napproval:approval/approval_date=@{org.nuxeo.ecm.core.schema.utils.DateParser.formatW3CDateTime(CurrentDate.date)}","save":"true"},"input":"/default-domain/workspaces/Sample Content/Test","context":{}}
{
"entity-type": "exception"
"code": "org.nuxeo.ecm.automation.TraceException"
"status": 500
}
In case I add the date manually it works:
{"params":{"properties":"approval:approval/approval_a_typ=1\napproval:approval/approval_date=2016-09-09T11:14:42Z\napproval:approval/approval_approver=Administrator","save":"true"},"input":"/default-domain/workspaces/Sample Content/Test","context":{}}
How can I add the current date? Any help highly appreciated.
Thanks
Stefan
I don t think you can use EL (@{org.nuxeo.ecm.core.schema.utils.DateParser.formatW3CDateTime(CurrentDate.date)} ) along with the REST API
"For updating a date, you will need to expose the value as ISO 8601 format, for instance : <p>Example:<pre>dc:title=The Document Title<br>dc:issued=@{org.nuxeo.ecm.core.schema.utils.DateParser.formatW3CDateTime(CurrentDate.date)}</pre>"
And following this example the error provided above occurs.
2016-09-09 14:15:46,170 WARN [http-bio-0.0.0.0-8080-exec-51] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing org.nuxeo.ecm.webengine.WebException: Failed to invoke operation: Document.Update
Caused by: org.nuxeo.ecm.automation.TraceException:
chain Name: Document.Update Exception: OperationException Caught error: Failed to invoke operation Document.Update Caused by: java.lang.NumberFormatException: For input string: "@{or" Hierarchy calls
Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Document.Update
Caused by: java.lang.NumberFormatException: For input string: "@{or"