Error in help-desk workflow when adding comment via another workflow
I'm getting an error when adding a comment via a workflow. I'm not sure how to fix it:
Workflow @jetbrains/youtrack-workflow-notify-multiple-unregistered-users reports error: Parameter specified as non-null is null: method jetbrains.youtrack.ring.impl.HubSecurityImpl.hasPermission, parameter project
Here is the code I'm using:
action: function(ctx) {
var issue = ctx.issue;
var user = entities.User.findByLogin('robo_user');
var existingIssue = search.search(issue.project, '{Some filter}', user).first();
if (existingIssue) {
existingIssue.fields['Occurrence count'] += 1;
existingIssue.addComment(issue.description, user); // If I remove this line, there is no error.
}
}
Any ideas?
Please sign in to leave a comment.
According to the error message, the error is from another workflow, "@jetbrains/youtrack-workflow-notify-multiple-unregistered-users", from the rule "Send notifications to all unregistered users", which is triggered when the comment is added to the `existingIssue`. Could you please go to that rule in in-browser editor, open its console and show the complete stack-trace for that rule?
Here is the full stack:
EDIT: In anticipation of a possible question: The robo_user has a Developer role on the project with full rights to change the fields and comments on an issue.
Thank you for the details. I do not see any obvious error in your code, this behaviour looks like a bug for me.
Could you please specify the version and build of YouTrack that you see this behaviour at? It will help me to create a more precise issue.
It's a InCloud YouTrack version 2017.3 - Build 37260 Mon, Oct 30, 2017, 7:50:56 AM UTC
I'll try work around it by disabling the youtrack-workflow-notify-multiple-unregistered-users rule when the user is "robo_user" for now.
Thanks for looking at this.
I have created a bug about this use case: https://youtrack.jetbrains.com/issue/JT-44155.
Great! I look forward to the fix.