0
votes

In a VSTS task I have several inputs. I want to make on input dependent on another. Relevant parts of my JSON below:

 "inputs": [
        {
            "name": "Wakeup",
            "type": "boolean",
            "label": "Wakeup",
            "defaultValue": "false",
            "required": false,
            "helpMarkDown": "Makes a wake-up request to the site after deploying.",
            "groupName": "advanced"
        },
        {
            "name": "SiteUrl",
            "type": "string",
            "label": "SiteUrl",
            "defaultValue": "",
            "required": false,
            "helpMarkDown": "The url to the site.",
            "groupName": "advanced"
        }
    ]

If Wakeup is selected, then SiteUrl should be required. But if Wakeup isn't selected SiteUrl shouldn't even be editable for the user (if possible).

I've been looking at the build task-schema, but cannot figure it out. I guess I should be able to use visibleRule, but don't know how.

1

1 Answers

1
votes

Try this code:

{
      "name": "SiteUrl",
      "type": "string",
      "label": "SiteUrl",
      "defaultValue": "",
      "required": true,
      "helpMarkDown": "The url to the site.",
      "visibleRule": "Wakeup = true",
      "groupName": "advanced"
    }