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

Fn.getVocabularyLabel should handle hierarchical vocabulary ids

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Directory

      Description

      A valid id for a hierarchical vocabulary entry is "PARENT_ID/CHILD_ID". However, theĀ Fn.getVocabularyLabel platform function does not recognise this id and returns it verbatim.

      Expected Result:

      Fn.getVocabularyLabel("country", "europe/France") -> "label.directories.country.France"

      Actual Result:

      Fn.getVocabularyLabel("country", "europe/France") -> "europe/France"

      Workaround:

      Split the vocab id by separator, and provide the child id only e.g.

      Automation:

      var id = input["schema:field"].split("/")[1];
      Fn.getVocabularyLabel("country", id); // "label.directories.country.France"
      

      FreeMarker:

      <#assign k=Document['schema:field']?split('/')?last />${Fn.getVocabularyLabel('country', k)}
      

      Caveat: need to check the property actually has a value, which creates additional complexity and should be handled automatically by the platform function.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              msaye Mark Saye
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: