cancel
Showing results for 
Search instead for 
Did you mean: 

Populate Multiple fields with document suggestion results

Robert_Smith
Champ on-the-rise
Champ on-the-rise

I'm trying to use the document suggestion results to populate multiple UI fields after selection. The only value accessible post-selection is the document id. Is there a way to return a document object after selection, or is there an API call that can be used to pull the document details (metadata) post-selection? I'm also thinking I could do a rest call to pull the document details if there is not a better way of doing so within studio.

//HTML segment

nuxeo-document-suggestion id="BU" role="widget" value="{{document.properties.AP_Invoice:Route_CD}}" label="BU" min-chars="1" on-value-changed="_getSuggestionDoc" enrichers="thumbnail" result-formatter="[[thumbnailFormatter]]" >

Polymer script seciton:

_getSuggestionDoc: function(e) {

alert(JSON.stringify(e.detail));
//_getThumbnailUrl: function(doc) {

   // retu "/nuxeo/api/v1/id/" + doc.;
  

}

2 REPLIES 2

a_c
Confirmed Champ
Confirmed Champ

You can use a <nuxeo-resource id="someId"><nuxeo-resource/> element to query the document with the document rest API endpoint for documents https://doc.nuxeo.com/nxdoc/rest-api-endpoints/, simply pass the endpoint url to the path property of the element.

Then you would have to handle the value change at the _getSuggestionDoc function, when the id changes you would simply call this.$.someId.get().then( //do something). If you need additional document info you can always add document enrichers.

Robert_Smith
Champ on-the-rise
Champ on-the-rise

Thanks You ac !!!! I think this will work for this and tons of other use cases I'm working on! Much appreciated.

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.