Developers » Script Editor » Create New Script


Add New Script

Quick Links

Create New Script

[Back to top]

To create a new script go to Setup > Development > Scripts and:

  1. Select the Script option from the New menu, or click the Create New link from the instructional text on the Scripts workspace.

  2. Select the  Expand icon to expand or collapse additional fields.

  3. Complete the form fields:

    • Name: Enter a name.

    • Script Type: Select a script type. See Script Types for detailed information on script types and where they are used.
    • System ID: A unique identifier, automatically generated when you name an object. You can use this identifier to reference an object in scripts, templates, tags, and through the API. You can change the System ID by selecting the pencil icon. Use caution when changing the ID as it can affect existing scripts associated with the object. For more information, see System ID.

    • Language: Defaults to Groovy. You cannot change this setting.

    • Description: Add a brief description. This is used as an internal note for administrators.
  4. Use the reference tools on the right side of the workspace to look up objects and methods you can use in your script. Available methods and objects are limited based on the script type you selected.

  5. Write your script in the Code window using the Groovy scripting language. To enter full-screen mode, place your cursor in the Code  window and press F11. To exit the full-screen mode, press F11 or Esc.

  6. Select Debug to open the Debug workspace where you can troubleshoot the script. See Debug Tool for more information. Select the category in the Debug tool to ensure the information from the script is recorded.

  7. Select Validate to check the code syntax. Workflow displays the results of the script execution in the Output tab below the Code window.

  8. Click Save as Draft to save your work without exiting. Workflow saves your script alphabetically in the ROOT folder. You can drag and drop the script into another folder. See Manage Folders and Scripts for more information.

  9. Click Save and Publish to save your changes and publish the script.