PowerCLI

 View Only
  • 1.  External Validation with evalOGNL

    Posted Nov 13, 2023 09:38 AM

    Hello,

    I would like to create a Workflow in Orchestrator which to use External Validation with evalOGNL for an Array.

    My demo form json is below. The actual use case I need to implement is more complex, I just reduced the form json to the minimum required to present the problem I'm having.

    When I run the workflow it works ok if I "don't touch" the field, so if I just click Run then the validation works and returns the message "Test", but if I enter a value and click Run I get the error "Error performing external validation.". Even If I delete the value I entered I get the same error.

    My assumption is that what I defined as "field_type" is wrong and cannot be matched.

    Could you please help me to fix the issue? What should be used for "field_type"?

    I tried "Array/string", "Array", "string", even "Any"... but with the same result. If the field has or had a value then the error running the validations is thrown.

    {
    "layout": {
    "pages": [
    {
    "id": "page_x2j7gicd",
    "sections": [
    {
    "id": "section_b5cce0b6",
    "fields": [
    {
    "id": "demo_array",
    "display": "array",
    "signpostPosition": "right-middle",
    "state": {
    "read-only": false,
    "visible": true
    }
    }
    ]
    }
    ],
    "title": "",
    "state": {}
    }
    ]
    },
    "schema": {
    "demo_array": {
    "id": "demo_array",
    "type": {
    "dataType": "string",
    "isMultiple": true
    },
    "label": "Demo Array"
    }
    },
    "options": {
    "externalValidations": [
    {
    "label": "Demo required",
    "target": ["demo_array"],
    "source": {
    "id": "com.vmware.o11n.forms/evalOGNL",
    "type": "scriptAction",
    "parameters": [
    {"ognl": "`\"test\"`"},
    {"field": "demo_array"},
    {"field_type": "`Array/string`"},
    {"return": "`string`"}
    ]
    }
    }
    ]
    },
    "itemId": ""
    }


  • 2.  RE: External Validation with evalOGNL

    Posted Sep 04, 2024 05:29 AM

    Hi
    In the ognl field, I think you can't just put a text "test". It contains either an action or a variable with the character #