Skip to main content

Use the Snippets library

Copy a ready-made script from the Snippets library into the Script Console, then change it for your own data.

Applies to: Script Master for Jira and Script Master for Confluence Β· Cloud

The library has two groups. Snippets are short examples of one API call. Use Cases are complete scripts for a real task, with their settings at the top.

Before you begin​

  • Jira or Confluence permission: Jira admin (the Administer Jira global permission) or Confluence admin.
  • App permission: an active Script Master license, to run the script.

Copy a snippet into the editor​

  1. On the Script Console tab, select Snippets. The Snippets Library opens.

  2. Find a script in the list on the left. To narrow the list, type in Filter by name or description.

  3. Select the script. Its description and code appear on the right.

    The Snippets Library with the Snippets and Use Cases lists and the selected snippet's code

  4. Select the copy icon next to the script's name.

  5. Select Close, then paste the script into the editor with Ctrl+V (Cmd+V on a Mac).

  6. Change the settings at the top of the script, such as keys, IDs or a JQL query.

  7. Select Run.

Result: The script runs as you and its result appears below the editor. See Script Console output.

warning

Some use cases change or delete data for real, for example Permanently purge trashed pages from multiple Confluence spaces. Read the script and its settings before you select Run.

What's in the library​

ProductSnippetsUse Cases
JiraCalling the Jira REST API, fetch to another system, getting, creating and updating a work item, and the Forge bridge methodsChange the owner of multiple filters
ConfluenceCalling the Confluence REST API, fetch to another system, showFlag, creating a page and adding a comment to a pagePermanently purge trashed pages from multiple Confluence spaces

Snippets are starting points, not finished scripts. Check each response before you use it, for example with if (!response.ok). To search with JQL, use the example in Find work items with JQL: it calls the current search endpoint.

More examples in our docs at the bottom of the library opens the Script Console examples in these docs.