cancel
Showing results for 
Search instead for 
Did you mean: 

Complex field cannot be updated?

kapelan_
Champ in-the-making
Champ in-the-making

I'm trying to update document's metadata by using Nuxeo Automation Java Client. It's working on SimpleType fields but every try on complexType fields failed. I red it is possible by updating a document with the JSON values. So I tried example code:

    // Fetch the document
Document document = (Document) session.newRequest(DocumentService.GetDocumentChild).setInput(new PathRef("/")).set("name", "testDoc").execute();
 
// Send the fields representation as json
 
// Read the json file
File fieldAsJsonFile = FileUtils.getResourceFileFromContext("creation.json");
String fieldsDataAsJSon = FileUtils.readFile(fieldAsJsonFile);
 
// Don't forget to replace CRLF or LF
fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", "");
fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", "");
 
// Set the json values to the related metadata
document.set("ds:fields", fieldsDataAsJSon);
 
// Document Update
session.newRequest(UpdateDocument.ID).setInput(document).set("properties",document).execute();

Server is sending me back a message: "Property not found: ds:fields". Probably I'm using it wrong, but someone can tell how I should work with it properly?

1 REPLY 1

Vladimir_Pasqui
Star Collaborator
Star Collaborator

Hi,

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.