Execute a custom action from the workflow
Hi,
I'm porting my current workflow to Javascript as I try to add more functionality, things seem great, I really like as it's really easier to use a source control, great job we're really enjoying Youtrack and the direction it's taking.
My problem is that I'm trying to reuse some functionality, I've a custom action that I want to call when a certain trigger happens.
Example:
exports.rule = entities.Issue.action({
title: 'Reopen Issue',
command: 'reopen',
guard: function(ctx) {
return true;
},
action: function(ctx) {
var issue = ctx.issue;
issue.fields.State = ctx.State.InProgress;
},
...
Then I would like to do something like this from a change action:
exports.rule = entities.Issue.onChange({
title: 'Adding-comments-to-inforequest-reopens-ticket',
guard: function(ctx) {
return [some condition];
},
action: function(ctx) {
var issue = ctx.issue;
command('reopen', issue);
},
Is this something that is possible? Or do I have to build the common functionality and export it as a custom script like in the example in Custom Scripts.
Thanks,
Marco Cordeiro
Please sign in to leave a comment.
Nevermind found the solution:
Thank you for sharing the solution!