> This page is for Docs.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# Create a function from scratch

> Learn how to create a function from scratch.

Learn how to create a function from scratch.

To create functions, you must have a basic understanding of JavaScript functions. For more information, see [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) and [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions) in MDN Web Docs.

Navigate to **Custom logic entry** in the left navigation menu.

Click **Create Logic** and then click **Create from Blank**.

In the displayed Create New Logic dialog, complete the following information:

* **Type**: Select **Function**.
* **Name**: Enter the function name. The name must be unique across all custom logics.
* **Object**: Select the related object.
* **Description**: Enter the function description.

Click **Save And Continue**. The function editor opens.

Enter the JavaScript code of the function body. Note that Zuora provides the other parts of the function except the function body by default. See the following snippet as an example. It can be a validation or formula function. For more information, see [Function types](/docs/platform/extensibility/custom-logic/function/function-overview), [Function format](/docs/platform/extensibility/custom-logic/function/function-format), and [Use cases and code samples](/docs/platform/extensibility/custom-logic/function/use-cases-and-code-samples/validation-function-use-cases).

```
((account) => { //Available by default
 … //Function body. Enter this part in the field 
})(account) //Available by default
```

Optional: Test the function. For more information, see [Test a function](/docs/platform/extensibility/custom-logic/function/function-management/test-a-function).

If you want to activate the function, click **Activate**. Active functions are effective immediately, whereas draft functions are not. Note that only one active function is allowed for each object.

Click **Save**.