Pass chain parameters from document suggestion widget

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 :

  1. I'm really not sure about the “?” syntax for the search parameter
  2. The chain parameters are empty when they get called by the GetSearchQuery operation

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.

0 votes

0 answers

43 views

ANSWER