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 and Functions in MDN Web Docs.
- Navigate to Extension Studio > Custom Logic 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, Function format, and Use cases and code samples.
((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.
- 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.