07-22-2020 09:28 AM
Hi,
I'm trying to pass parameters from a nuxeo-document-suggestion widget to the automation chain returning the suggested documents.
Here is the widget :
<nuxeo-document-suggestion
value="{{document.properties.mfs:documents}}"
label="[[i18n('manufacturing_summary.documents')]]"
multiple="true"
min-chars="0"
role="widget"
stayOpenOnSelect="true"
operation="SearchDocuments"
params="{'searchTerm':'?', 'doctype':'hwp_document', 'parentId':'#{documentManager.getParentDocument(currentDocument.parentRef).id}'"
></nuxeo-document-suggestion>
And here is the automation chain :
<chain id="SearchDocuments">
<param type="string" name="searchTerm"/>
<param type="string" name="doctype"/>
<param type="string" name="parentId"/>
<operation id="GetSearchQuery">
<param type="string" name="searchTerm">expr:ChainParameters['searchTerm']</param>
<param type="string" name="doctype">expr:ChainParameters['searchTerm']</param>
<param type="string" name="parentId">expr:ChainParameters['parentId']</param>
</operation>
<operation id="Context.SetInputAsVar">
<param type="string" name="name">query</param>
</operation>
<operation id="Repository.Query">
<param type="string" name="language">NXQL</param>
<param type="string" name="query">expr:Context['query']</param>
<param type="stringlist" name="sortBy">dc:title</param>
<param type="stringlist" name="sortOrder">ASC</param>
</operation>
</chain>
As you can see, I tried to pass them through the "params" field (as suggested by the documentation), but :
I could try to directly access those parameters from the automation context, but being called from a widget in the creation form, the current document (i.e. the parent of the document being created) is not accessible in this context.
08-06-2020 09:44 AM
Ok, I think that I managed to solve this on my own (I don't even know why I still post stuff here, I never get any answer).
The widget :
<nuxeo-document-suggestion value="{{document.properties.mfs:documents}}"
label="[[i18n('manufacturing_summary.documents')]]"
multiple="true"
min-chars="0"
role="widget"
placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
operation="SearchDocuments"
params="[[params]]"
></nuxeo-document-suggestion>
The script :
<script>
Polymer({
is: 'nuxeo-manufacturing_summary-create-layout',
behaviors: [Nuxeo.LayoutBehavior],
properties: {
/**
* @doctype manufacturing_summary
*/
document: Object,
params: {
type: Object,
value: {"doctype": "hwp_document", "docId": document.id}
},
},
});
</script>
BUT my troubles are not over because my docId param is empty, which makes sense because my document is not created yet, and all its properties are empty.
document.id or document.path both return a null value, and I have no idea how to get the parent's ref (that's my ultimate goal). If you have ANY idea please feel free to share.
Have a good day !
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.