Developer Portal for YouTrack and Hub Help

Clone Article

This workflow contains one action rule that lets users clone articles.

Name

@jetbrains/youtrack-workflow-clone-article

Auto-attached

yes

Rules

  • Clone article as draft (action)

Use Case

This workflow is designed to help users create an exact copy of an existing article in the knowledge base, including its tags, visibility restrictions, and attachments. This is supported by an action rule, so users can perform this operation on the fly, as required.

To learn more about cloning articles in YouTrack, see https://www.jetbrains.com.cn/en-us/help/youtrack/server/clone-articles.html.

Rules

This workflow has one rule that clones an article as a draft.

Rule

Description

Clone article as draft

Creates a copy of the current article as a draft. Once the draft has been created, you can find it in the left navigation panel or list of Drafts in the knowledge base.

This workflow runs when users select the Clone article as draft action from the Show more options menu in the article toolbar.

Clone article as draft

First, the rule sets up a custom action called Clone article as draft. This adds this action to the article toolbar in articles that belong to a project where this rule is active.

When this action is triggered, it creates a draft copy of the current article using the createDraftCopy() method. The draft copy is a duplicate of the original article, saved as a personal draft. Drafts serve as editable work-in-progress versions of articles that aren't yet published or visible to others.

After creating the draft, the message() method alerts the user to notify them that the cloned draft has been successfully saved. The alert includes a link (newArticle.url) that lets the user open and edit the draft immediately.

const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); const entities = require('@jetbrains/youtrack-scripting-api/entities'); exports.rule = entities.Article.action({ title: 'Clone article as draft', command: 'clone article as draft', action: function (ctx) { const newArticle = ctx.article.createDraftCopy(); workflow.message('A clone of the current article was saved to your list of drafts. <a href="{0}">Edit draft</a>', newArticle.url); } });
21 November 2025