## Zoho Payroll Documentation Index

Access the complete documentation index at:
https://www.zoho.com/in/payroll/llms.txt

Use this file to discover all available documentation pages before proceeding.

# Functions Using Zoho Finance CLI

 ![](/payroll/images/ue-resources/llm-utility-menu/sparkle-ai.svg) Explore With AI ![](/payroll/images/ue-resources/llm-utility-menu/dd-arrow.svg) 

*   [Open in ChatGPT (opens in new tab)](https://chatgpt.com/?prompt=Analyze+the+content+of+https%3A%2F%2Fwww.zoho.com%2Fin%2Fpayroll%2Fhelp%2Femployer%2Fsettings%2Fautomation%2Fworkflow-actions%2Ffunctions-using-zoho-finance-cli.html+and+understand+it+thoroughly+so+I+can+ask+questions+about+it.)
*   [Open in Claude (opens in new tab)](https://claude.ai/new?q=Analyze+the+content+of+https%3A%2F%2Fwww.zoho.com%2Fin%2Fpayroll%2Fhelp%2Femployer%2Fsettings%2Fautomation%2Fworkflow-actions%2Ffunctions-using-zoho-finance-cli.html+and+understand+it+thoroughly+so+I+can+ask+questions+about+it.)
*    ![Copy for LLM](/payroll/images/ue-resources/llm-utility-menu/copy.svg) Copy for LLM
*    [![View as Markdown](/payroll/images/ue-resources/llm-utility-menu/md.svg) View as Markdown (opens in new tab)](/in/payroll/help/employer/settings/automation/workflow-actions/functions-using-zoho-finance-cli.md)

The primary method to write a function in Zoho Payroll is through the built-in Deluge editor. If you prefer to write functions in **Java**, **Node.js**, or **Python**, you can use the **Zoho Finance CLI** to write the code on your device and push it to Zoho Payroll.

**Insight:** A Command-Line Interface (CLI) is a text-based interface used to run programs and interact with applications. You provide inputs through the command prompt or terminal, and the computer executes them.

**Prerequisite:** To use the Zoho Finance CLI, you need [Node.js](https://nodejs.org/en/download/package-manager) version 16 or later installed on your device. This comes with npx installed. Once installed, run the following commands to verify the installation:

*   `node -v`
*   `npx -v`

* * *

## Zoho Finance CLI Commands

The following commands are available in the Zoho Finance CLI:

Command

Description

**login**

Log in to your Zoho account.

**pull**

Download the function created in Zoho Payroll to your device.

**execute**

Run and verify that the function works as intended.

**push**

Push the code to Zoho Payroll and update the function.

**logout**

Log out of your Zoho account.

* * *

## Log In to Your Zoho Account

To use the CLI, you must first log in to your Zoho account from the terminal or command prompt.

*   Open the terminal or command prompt on your device.
*   Enter the command:

```sh
npx @zohofinance/cli login
```

*   Select the **DC** (data centre) in which your Zoho account was created. Zoho redirects you to the Zoho Accounts login page.
*   Click **Allow**. You are now logged in to your Zoho account.

* * *

## Download the Function

Before you can write code using the CLI, you must first [create a function](/in/payroll/help/employer/settings/automation/workflow-actions/functions.html) in Zoho Payroll and select a non-Deluge programming language (Java, Node.js, or Python). Then, download the function to your device.

*   Open the terminal or command prompt on your device.
*   Enter the command:

```sh
npx @zohofinance/cli pull "<URL>"
```

Replace `<URL>` with the download URL for your function. To get this URL, go to the function’s **Edit** page in Zoho Payroll and click **Copy** next to the CLI command. The URL contains your function’s ID and your organisation’s ID.

* * *

## Write the Code in the Editor

After downloading the function, a folder is created in your current working directory containing the necessary files.

*   Open the downloaded folder.
*   Open the file with the `.py`, `.js`, or `.java` extension, depending on the programming language you selected when creating the function. For example, if the function’s name is _sync\_employee\_data_ and the programming language is _Java_, the file is named **sync\_employee\_data.java**.
*   Write your function code in a code editor of your choice and save the file.

* * *

## Context Methods

When writing functions in Java, Node.js, or Python, a **context** object is automatically passed to your function. This object provides methods that let you interact with platform features:

*   **Log:** Record entries for debugging and monitoring.
*   **Cache:** Store and retrieve data with a time-to-live (TTL) for quick access.
*   **Queue:** Send messages using an in-memory queue with persistent storage.
*   **Store Files:** Upload and manage files using Stratus, an internal file storage service.
*   **Schedule:** Set functions to run at a specific time or on a recurring basis using Docket.
*   **Connect:** Authenticate with third-party services using Connectors.

For detailed method references and code samples in Java, Node.js, and Python, see [Context Methods](/in/payroll/help/employer/settings/automation/workflow-actions/functions-context-methods.html).

* * *

## Execute the Code

You can execute the function locally to verify that it works as intended before pushing it to Zoho Payroll.

*   Open the terminal or command prompt on your device.
*   Enter the command:

```sh
npx @zohofinance/cli execute
```

*   In the **Enter the entity id** field, enter the ID of a record in the module for which you created the function. You can find the entity ID in the URL when you open the record in Zoho Payroll.

Once the function is executed, the result is displayed in the terminal.

* * *

## Push the Code to Zoho Payroll

After writing and testing the function, push it to Zoho Payroll to update the function in the application.

*   Open the terminal or command prompt on your device.
*   Enter the command:

```sh
npx @zohofinance/cli push
```

The function is now updated in your Zoho Payroll organisation.

**Note:** Functions created using the Zoho Finance CLI cannot be edited from within Zoho Payroll. They can only be edited in the terminal or command prompt. You can delete these functions directly from Zoho Payroll if needed.

* * *

## Log Out of Your Zoho Account

After pushing the function, log out from your Zoho account.

*   Open the terminal or command prompt on your device.
*   Enter the command:

```sh
npx @zohofinance/cli logout
```

* * *

## Related Topics

*   [Functions](/in/payroll/help/employer/settings/automation/workflow-actions/functions.html)
*   [Context Methods](/in/payroll/help/employer/settings/automation/workflow-actions/functions-context-methods.html)
*   [Workflow Rules](/in/payroll/help/employer/settings/automation/workflow-rules.html)
*   [Workflow Logs](/in/payroll/help/employer/settings/automation/workflow-logs.html)