Quick Start Guide
This quick start guide introduces you to setting up the ZDK CLI, helping you swiftly grasp the fundamental steps involved in using ZDK CLI. The steps involved in this quick start guide are:
- Install ZDK CLI
- Create a ZDK CLI project
- Login to your CRM org
- Pull metadata
- Add new metadata or make changes to existing metadata
- Push the changes
Install ZDK CLI
System Requirements:
- Windows - Windows 8.1 or later
- Linux - Ubuntu 20.04 or later
- Mac - macOS 10.11 or later
Other required software: npm - 8.1.0 or later, node - v14.17.6 or later.
You can install NPM on your system to install the ZDK CLI.
To check if you already have Node.js and NPM installed, run the following commands in your terminal which would display their installed versions, if present.
node -v
npm -v
If you don’t have them installed, you can download download Node.js from their official website, or use a Node version manager like NVM to install Node.js and NPM. NPM comes bundled with Node.js when you install it. Refer to the Node.js help documentation or NPM documentation for further help.
Run the command below to install ZDK CLI
npm install -g @zohocrm/zdk-cli
Note
If you are unable to install or update ZDK CLI, try executing the command using sudo.
Create a ZDK CLI Project
A ZDK CLI project has a specific directory structure and a configuration file that identifies the directory as a ZDK CLI project. To create a ZDK CLI project, run the command zdk init from the directory where you want the ZDK CLI project located. You will be prompted to enter the project name which is the name of the Project directory.
zdk init
Project directory
The ZDK CLI project directory is the root directory of the ZDK CLI project that contains the metadata of your org, including the project configuration file named zdk-project.json.
Upon executing the zdk init command, the project directory is created with the provided name. Please note that you must run the subsequent commands exclusively from this directory and not from any of its sub directories. For instance, if you designate the project name as "ZDKProject", subsequent actions should be carried out exclusively within the directory "ZDKProject".
Update ZDK CLI to the Latest Version
When a new version of ZDK CLI is available, your terminal will alert you after you successfully execute a ZDK CLI command.
To update ZDK CLI, execute the following command in your terminal:
npm install -g @zohocrm/zdk-cli
This will initiate the installation process for the latest version.
Login to your CRM org
To login to your CRM org run the command:
zdk auth:login
This command redirects you to a webpage where you will be prompted to log in to your Zoho account. On the webpage, a permission prompt is presented. The result of the login attempted is communicated in the CLI.
Note
For the beta release, only sandbox is supported for authentication.
Pull Metadata and make changes
To pull Zoho CRM metadata, run zdk org:pull and zdk org:pull:update command sequentially. The zdk org:pull command pulls the metadata to the local folder. The zdk org:pull:update updates the local directory with the pulled data.
zdk org:pull
zdk org:pull:update
Add new metadata or make changes to the existing metadata
To add new Zoho CRM metadata, run the command zdk meta:create {type}.
zdk meta:create {type}
Valid metadata types are modules, fields, layouts, widgets, profiles, and roles.
For updating existing metadata, locate and open the corresponding JSON file associated with the metadata you want to modify. Inside the JSON file, locate the specific values you want to change, make the necessary changes, and then save the file. For details regarding name and location of JSON files of different metadata types, refer this table.
For more details on the properties that are modifiable for each metadata refer this page.
The zdk org:status displays the local changes done after the previous pull or push.
zdk org:status
Push the changes
To push changes to environment you can use zdk org:push command. If there are no changes in the remote copy of a file for which local changes are also present, the push command will be executed smoothly. If there are changes in the same in remote, you need to resolve the difference (conflict) using zdk org:pull:resolve command.
zdk org:push
zdk org:pull:resolve