YouTrack Standalone 2017.3 Help

JavaScript Workflow Reference

Starting from YouTrack 2017.2, you don't have to write workflows in a domain-specific programming language. Just use JavaScript!

JavaScript is arguably the most popular programming language in the world today. If you yourself aren't familiar with it, chances are that there is someone in your organization who is fluent. By switching to JavaScript, we hope to make writing workflows for YouTrack more accessible than ever.

That said, to create your own workflows, you do need write some code. This requires a basic understanding of JavaScript. Luckily, there are a lot of resources available on the web, one of the best of which is provided by the Mozilla Foundation, who continues to oversee the development of the language.

This also means that you don't need to do anything out of the ordinary when you write workflows in JavaScript. You can use any of the declarations, variables, constants, data types, literals, functions, expressions, and operators that are supported in JavaScript when you write a workflow.

This section of the documentation provides a few guidelines that help you understand how to work with the custom properties and methods that are specific to the workflow API. For a complete list of functions, properties, and methods, refer to the YouTrack Workflow API.

Major Changes from the Previous Workflow Programming Language

Switching to JavaScript changes how you reference specific entities and properties when you write a workflow. Here is a short list of the major changes in comparison to the previous API:

  1. The issue reference is never omitted. You can't call an issue method assuming that it references an issue from the context — you must reference the issue explicitly.

  2. Property-related methods are spelled differently. Also, these functions are now properties. Get methods are simplified.

    MPS-based API

    JavaScript API

    issue.becomesResolved(), issue.becomesReported()

    issue.becomesResolved, issue.becomesReported

    issue.getId(), issue.getUrl(), issue.url

  3. Fields-related keywords are now methods.

    MPS-based API

    JavaScript API


    issue.fields.required(ctx.X, <message>)




    issue.fields.becomes(ctx.X, <ctx.X.value>)



  4. Global keywords and warning statements have changed.

    MPS-based API

    JavaScript API


    workflow.message(<message>) (see '@jetbrains/youtrack-scripting-api/workflow' module)


    workflow.check(<condition>, <message>) (see '@jetbrains/youtrack-scripting-api/workflow' module)



    now (standard JS date API)

  5. Some methods are changed completely:

    MPS-based API

    JavaScript API

    loggedInUser.createNewIssue(<project name>)

    new entities.Issue(<user>, <project>, <summary>)

Last modified: 7 March 2019