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

Allow passing json data when setting workflow variables in StartWorkflowOperation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.9.2
    • Fix Version/s: 5.8.0-HF10, 5.9.3
    • Component/s: Workflow

      Description

      Variables can be set on the new workflow by invoking this operation with a parameter 'properties' of type org.nuxeo.ecm.automation.core.util.Properties ( implements by default a HashMap<String, String>()).
      For exemple:

      stringVar=The Document Title
      dateVar=@{org.nuxeo.ecm.core.schema.utils.DateParser.formatW3CDateTime(CurrentDate.date)}
      

      But when trying to pass a variable of type StringList, the following exception is thrown:

      Caused by: org.nuxeo.ecm.core.api.model.PropertyConversionException: Property Conversion failed from class java.lang.String to class [Ljava.lang.Object;:
      

      Since NXP-13653 a new method was added , to set a list of properties based on their JSON representation:

      setJSONProperties(CoreSession session, DocumentModel doc, Properties properties)
      

      This should be used to set the workflow variables:

      • will allow to set variables of complex types by submitting a json string and keeping the backward compatibility since the operation gets a parameter of type Map<String, String> ( properties). For example, in order to set a variable of type StringList:
          assignees = ["John Doe", "John Test"]
        
      • no migration required on Studio side for existing chains, since until now only scalar types were supported ( = json representation by default)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: