Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-1054

Fix stored value when saving a Document field in WebUI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.0, 3.0.0-SNAPSHOT
    • Fix Version/s: 2.4.14, 3.0.0
    • Component/s: Selectivity
    • Release Notes Summary:
      The Path reference can be stored with nuxeo-document-suggestion.
    • Tags:
    • Backlog priority:
      650
    • Upgrade notes:
      Hide

      To use correctly nuxeo-document-suggestion widget referencing documents by path using the following approach:

      <nuxeo-document-suggestion ... id-property="ecm:path"/>

       

      Show
      To use correctly nuxeo-document-suggestion widget referencing documents by path using the following approach: <nuxeo-document-suggestion ... id-property= "ecm:path" />  
    • Team:
      GANG
    • Sprint:
      nxGang Sprint 11.1.17
    • Story Points:
      3

      Description

       Steps to reproduce:

      1) Define a document type and configure a field of type Document and choose to store the document path

       <xs:element name="reference">
          <xs:simpleType>
            <xs:restriction base="xs:string" ref:resolver="documentResolver" ref:store="path"/>
          </xs:simpleType>
        </xs:element>

      2) Write the code to set the Document field from a Suggestion element

          <nuxeo-document-suggestion role="widget" value="{{document.properties.mydocument:reference}}" label="Reference"></nuxeo-document-suggestion>
       

      3) Deploy the project
      4) Create a document of this new type
      5) In the Suggestion field, type "work" and choose an item among the results
      6) Submit the form
      7) Observe that the creation fails

      The HTTP response contains the reason for the error : a constraint violation

      {
        "entity-type": "validation_report",
        "has_error": true,
        "number": 1,
        "violations": [
          {
            "message": "\"9a00c571-d78c-4...\" is not a valid document path.",
            "invalid_value": "9a00c571-d78c-4943-b036-a12eb110eb74",
            "constraint": {
              "entity-type": "validation_constraint",
              "name": "documentResolver",
              "parameters": {
                "store": "path",
                "validation": "true"
              }
            },
            "path": [
              {
                "field_name": "mydocument:reference",
                "is_list_item": false
              }
            ]
          }
        ]
      }
      

      Expected result: the document should be created without error and the document path (not the document id) should be stored in this metadata

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h