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.
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.