Optional body parts from optional parameters?

Here are my mappable parameters:

[
    {
        "name": "docData",
        "type": "buffer",
        "label": "Document Data",
        "required": true
    },
    {
        "name": "docName",
        "type": "filename",
        "label": "Document File Name",
        "required": true
    },
    {
        "name": "stepsData",
        "type": "buffer",
        "label": "Steps Json Data",
        "required": true
    },
    {
        "name": "x1data",
        "type": "buffer",
        "label": "Extra File Data 1",
        "advanced": true,
        "required": false
    },
    {
        "name": "x1name",
        "type": "filename",
        "label": "Extra File Name 1",
        "advanced": true,
        "required": false
    }
]

And my communication:

{
    "url": "/impose",
    "method": "POST",
    "type": "multipart/form-data",
    "headers": {
  		"Content-Type": "multipart/form-data"
    },
    "body": {
        "doc": {
            "value": "{{ parameters.docData }}",
            "options": { "filename": "{{ parameters.docName }}" }
        },
        "steps": {
            "value": "{{ parameters.stepsData }}",
            "options": { "filename": "steps.json"}
        },
        "x1": {
            "value": "{{ parameters.x1data }}",
            "options": { "filename": "{{ parameters.x1name }}" }
        }
    },
    "response": {
        "type": "binary",
        "output": {
            "filename": "{{replace(replace(headers.`content-disposition`,'attachment; filename=',''),'\"','')}}",
            "data": "{{body}}"
        }
    }
}

The app runs fine when the scenario passes x1data and x1name. But when those are left blank, I get the following error:

TypeError
Cannot read properties of undefined (reading 'name')

Origin
Make

Passing an empty x1 to the HTTP service would be fine, but it looks like Make chokes before it even tries. How do I persuade make to pass empty values or omit x1?

Hi @JeffSnake
You should add a filter to continue the workflow only if both the values exist. This will stop errors.

Best regards
Shirin Saleem
Msquare Automation Solutions