Adding CC with workflow

I've tried everything but I cannot get this to work. I want to add an email as CC to helpdesk ticket using ccUsers but it does add the CC. The user email exists, I've added logs to make sure. Can anybody please provide me with a snippet for adding test@test.com to a helpdesk ticket when it is created.

0
2 comments
Official comment

Hi Anton! Here's a snippet that adds a user to the CC field when a helpdesk ticket is created:

   const entities = require('@jetbrains/youtrack-scripting-api/entities');
   exports.rule = entities.Issue.onChange({
     title: 'Add CC on ticket creation',
     guard: (ctx) => ctx.issue.becomesReported,
     action: (ctx) => {
       const user = entities.User.findUniqueByEmail('test@test.com');
       if (user) {
         ctx.issue.ccUsers.add(user);
       }
     },
     requirements: {}
   });

The ccUsers property is available in the workflow API since YouTrack 2026.1. User.findUniqueByEmail looks up a registered user by their email address, so test@test.com must be a registered user on your instance for this to work.

Make sure to update YouTrack to the latest build of 2026.1 to avoid the bug related to ccUsers in tickets submitted via online forms: JT-95303. If you're on YouTrack Cloud, your instance should already include this fix.

Thank you Stanislav Dubin. Seem like I've been doing it wrong but our admin did not update to the latest version. It works now

0

Please sign in to leave a comment.