Create a code snippet
In this topic, you learn how to create a code snippet that you can reuse in other tools.
Procedure
-
In the cockpit, select the Code Snippets tool.
Result: A table of existing code snippets is shown.
-
Select Create.
Result: The Create Snippet dialog opens.
-
In Name, enter a meaningful name for the code snippet.
-
In Grouping, select a grouping for the snippet to belong to. Alternatively define a new grouping by entering your desired grouping name.
-
Select Create.
Result: You start in the General tab of the code snippet.
-
In Description, enter a meaningful description for the code snippet.
-
In Package, assign a development package of artifacts to the code snippet.
-
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. -
Select the Editor tab.
-
Input your code here.
To import existing code into the editor, select Import. The file must be in .planet9
format. -
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.