Move the issue from current project to another.
Hi all.
I am trying to move issue from one project to another from workflow.
I've tried in two ways:
ctx.issue.applyCommand('project PROJ2');
and
var newProject = entities.Project.findByKey('PROJ2');
ctx.issue.project = newProject;
but in both cases I got errors:
Workflow developer reports error: Invalid argument: null (@jetbrains/youtrack-scripting-api/entities#308)
Is this the correct way to move issue from one project to another?
PS: from the web-interface via Command Dialog the command:
'project PROJ2'
running successfully.
Thanks.
Please sign in to leave a comment.
Hi Dmitry,
I've just tried the same rule on YT 2018.1, and it works for me.
This exception message doesn't tell much, unfortunately. Most probably, it is another rule failing, which belongs either to 'KD' or to 'KEP' project. I would suggest you to contact the support team and provide the logs of your YouTrack server.
Could you please show the complete code of the script that you have and tell the number of the build of your YouTrack instance?
Were you able to sort this out?
@Lo Chupa No, unfortunately, the full code was not shared.
Hi,
Sorry, I lost the previous message..
There is a full code of rule for testing:
Here, for testing, I trying to switch the project in issue from one to another. And got error:
maybe I'm doing it wrong?
This code doesn't work too:
I forgot about number of build, it is:
OK, thanks. I will continue to understand myself.
Hi Dmitry,
Please try to add 2 debug lines before
So the guard will look like this:
And let me know the result you see in the console.
Hi,
There is output (I created the new issue KD-10283 for testing but anyway):
The code:
The output
Could you please elaborate why do you use such guard condition? Do you want the rule to trigger only for one specific issue or this is just for test purposes?
Please try the following:
, where KP is a short name of target project.
Change anything in KD-10283 and let me know the error message you see on issue page and the console output.
Btw, I'd recommend creating a support request so we could investigate this case properly (https://youtrack-support.jetbrains.com/hc/en-us/requests/new?ticket_form_id=66282).
Yes, I want to test this rule only for one specific issue.
There is the output:
And error message in web-interface: