---
schema_version: "1"
id: 7cfb040586e253553d48ba6f2b41566ebe6772bf0f7ed14108b6d0865e04ecae
title: Interactivity
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfcliplugin/guides/design/interactivity.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-plugin/guide/interactivity.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 01cfe419fda595ba819d95abbb39e6ca25b281c6f1cc27d839e31c5e9c1a62df
products:
  - Salesforce CLI Plugin Developer Guide
  - salesforcedx
---
# Interactivity

Interactive commands are a powerful way to develop a great experience for your users. Our goal is to make Salesforce CLI approachable to all users, and interactivity helps make this possible. Keep these general guidelines in mind while implementing interactive prompts.

## Ask as Few Questions as Possible

We recommend that you ask as few questions as possible so as to not overwhelm your users. Asking users dozens of questions all at one time can cause decision fatigue and lead to a poor experience. Instead, ask the most meaningful and necessary questions to gather the information you need.

## Scripting

Many Salesforce CLI users leverage the `--json` flag to write scripts for their continuous integration (CI) environments. These users often load the JSON response into a JSON parsing utility like `jq`. As a result, the JSON output in stdout must be parsable or else these users' scripts fail.

If you implement a prompt on a command that supports `--json`, the resulting JSON isn't parsable because the prompts are part of the stdout.

We recommend you implement one of these:

- Develop commands that are either interactive or scriptable (support `--json`), but not both. In other words, if you plan for a command to be interactive, then disable the `--json` flag by setting `enableJsonFlag = false` on the command class that extends `SfCommand`.

- If you require a command that is both interactive and scriptable, then add flags that supply the same information gathered by the interactive prompt. You must use `this.jsonEnabled` before starting the prompt so that you don't accidentally prompt the user when they provide the `--json` flag.
