Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-24700

Fix widget 'Multiple generic suggestion (advanced)' when used in a multi-valued complex property

    XMLWordPrintable

    Details

    • Release Notes Summary:
      Multi-value complex property has the expected behavior used in a multiple generic suggestion widget.
    • Tags:
    • Backlog priority:
      1,000
    • Team:
      AT
    • Sprint:
      nxfit 10.2.7, nxAT Sprint 10.10.2, nxAT Sprint 10.3.4, nxAT Sprint 10.10.1, nxAT Sprint 11.1.1, nxAT Sprint 11.1.2
    • Story Points:
      5

      Description

      Widget 'Multiple generic suggestion (advanced)' used for a multi-valued string property in a multi-valued complex property does not save updates when there is only 1 item in the multi-valued complex property.

      How to reproduce:

      Configuration in Studio

      Automation scriting

      Create a new Automation Scripting named NXP24700 with:

      • a parameter named searchTerm
      • Output type blob
      • the following code:
        function run(input, params) {
          Console.warn('Filter: ' + params.searchTerm);
        
          // initialize basic suggestions array
          var suggestions = [];
          suggestions.push({'id':0, 'displayLabel':'0'});
          suggestions.push({'id':1, 'displayLabel':'1'});
          suggestions.push({'id':2, 'displayLabel':'2'});
          
          // filter array based on 'searchTerm' parameter
          function filter_suggestions(entry) {
            return entry['displayLabel'].startsWith(params.searchTerm);
          }
          var filteredSuggestions = suggestions.filter(filter_suggestions);
          
          // build blob to return to suggestion widget
          ctx.resultsString = JSON.stringify(filteredSuggestions);
          var resultsBlob = Context.RestoreBlobInputFromScript(null, {
            script: 'This=new org.nuxeo.ecm.core.api.impl.blob.StringBlob(resultsString,"application/json");'
          });
          return resultsBlob;
        }
        

      Document type

      • define a new document type named NXP-24700
      • in schema tab, add a multi-valued complex field named complexlist
      • edit the complexlist field and add a multi-valued string field named field1
      • in the Edit layout tab, select schema nxp-24700 under Widgets by property section of Featured Widgets and drag and drop Complexlist on the WARNING widget in column Column 1 of the layout
      • edit the widget and set attribute Display to Table and save
      • edit Complexlist widget's subwidget Field1 and change its Widget Type to Multiple generic suggestion (advanced) and save
      • edit Field1 subwidget and:
        • set Minimum characters to 0
        • set Operation Id to javascript.NXP24700
        • set Inline javascript to:
          function myformatter(doc) {
            return doc.id;
          }
          
        • set Selection Formatter to myformatter
        • remove custom property listTemplateItem if defined
      • save the document type
      • edit layout View layout and import the Edit layout. Save the document type
      • deploy the Studio project in a Nuxeo instance

      Reproduction in Nuxeo instance

      • create a workspace named NXP-24700
      • create a document of type NXP-24700 (fill the mandatory field Title)
      • go to Edit tab, add an item to Complexlist field and select 0 in field Field1
      • click Save
      • back in Summary tab, Complexlist field has 1 item with Field1 set to 0
      • go to Edit tab again, add 1 to field Field1 of existing item of field Complexlist
      • click Save

      Expected result: back in Summary tab, Complexlist field has 1 item with Field1 set to 0 and 1.

      Actual result: back in Summary tab, Complexlist field has 1 item with Field1 set to 0 ONLY.
      The problem only occurs when the field Complexlist contains only 1 item.

      Workaround: Add a 2nd empty item to field Complexlist, then, updates to Field1 get saved.

        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 - 3 days, 5 hours
                  3d 5h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.