1
0
-1

Hello,


We are syncing issues between two Jira Instances. 


Users will have assignee permissions on Jira instance A, but may or may not have assignee permissions on Jira instance B


I have used the code snippet from: https://docs.exalate.com/docs/isuserassignable-49152291


def assignee = nodeHelper.getUserByEmail(replica.assignee?.email)
if(nodeHelper.isUserAssignable(issue.projectKey, assignee)){
    issue.assignee = assignee
}else{
    issue.assignee = nodeHelper.getUserByEmail("default@admin.com")
}


However, when attempting to sync an issue where the user does not have assignee permissions on Jira Instance B, we are getting the following error:


Could not update issue `XXX-1234` with id `71551`: Field assignee: User '<userID>' cannot be assigned issues.. Check the documentation for more details.


Anyone else ever come across this?


Cheers,

Mike

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Mike,


      I hear you're facing an issue with assignee permissions during your Jira instance sync. It sounds like you're using the Exalate code snippet to handle this, but it's running into a snag when the assignee from Jira A doesn't have permissions on Jira B. 


      Here's what's likely happening:

      • The isUserAssignable function checks if the user retrieved by email has assignee permissions on the target project in Jira B.
      • If the user doesn't have permissions, the code assigns a default user ("default@admin.com").
      • However, Jira B throws an error because even the default user might not have assignee permissions for that specific project.

      Here are a couple of ways to address this:

      Refine Assignee Selection:

      • Instead of a hardcoded default user, try to find a user with assignee permissions in the target project on Jira B.
      • You could potentially loop through a list of users with the appropriate permissions and assign the first available one.

      Clear Assignee When Permissions Lacking:

      • If assigning someone else isn't feasible, consider leaving the assignee field blank in Jira B when the original assignee lacks permissions.
      • This can be achieved by changing the else block to:


      Python else: issue.assignee = None


      Additional Considerations:

      • Make sure the default@admin.com user actually has assignee permissions in the relevant projects on Jira B.
      •  Consider adding logging to your code to capture the email of the user who lacked permissions. This can help with troubleshooting later.

      By implementing one of these approaches, you should be able to handle situations where the assignee from Jira A doesn't have permissions on Jira B without encountering errors. If you've tried these suggestions and are still facing issues, feel free to share any error messages or additional details about your setup. The Exalate documentation might have more specific troubleshooting steps depending on your configuration.


        CommentAdd your comment...