Create a code snippet

In this topic, you learn how to create a code snippet that you can reuse in other tools.

Prerequisites

  • There are no prerequisites.

Procedure

  1. In the cockpit, select the Code Snippets tool.

    Result: A table of existing code snippets is shown.

  2. Select Create.

    Result: The Create Snippet dialog opens.

  3. In Name, enter a meaningful name for the code snippet.

  4. In Grouping, select a grouping for the snippet to belong to. Alternatively define a new grouping by entering your desired grouping name.

  5. Select Create.

    Result: You start in the General tab of the code snippet.

  6. In Description, enter a meaningful description for the code snippet.

  7. In Package, assign a development package of artifacts to the code snippet.

  8. To make your code snippet available in the App Designer and/or Script Editor, select Use in App Designer and/or Use in Script Editor.

    In the App Designer and in the Script Editor, you find your created code snippets under Custom when you try to insert a new code snippet.
  9. Select the Editor tab.

  10. Input your code here.

    To import existing code into the editor, select Import. The file must be in .planet9 format.
  11. Select Save. Result: Your code snippet is saved with the current settings and is added to the library in the App Designer and in the Script Editor.

Results

  • You have created a code snippet that can be used in the App Designer and/or Script Editor.