isUserAssignable() throws missing projectkey error when key is provided

Originally asked by Michel Bakker on 28 October 2020 (original question)


We’re currently setting up a sync between two instances, and we also want to sync the watchers if they have an account.
In the documentation we found the nodeHelper.isUserAssignable to check if a user can be assigned to an issue within the project.
But once we trigger the code we get a sync error “Script error details: No project or issue key was provided.” even though the project key is provided as per the documentation (https://docs.idalko.com/exalate/display/ED/isUserAssignable).
If we remove the snippet the synchronization works again.

The code we want to use:

def watchUser = nodeHelper.getUserByEmail(userEmail)
if(nodeHelper.isUserAssignable("QGO", watchUser))
{
	return watchUser;
}
return null;

The code which works (except if the user cannot be assigned due to missing permissions):

return nodeHelper.getUserByEmail(userEmail) ?: null;

Stack trace:
exalate-stacktrace.txt (old community)


Answer by Juan Grases on 30 October 2020

Hi! This was a bug that was already fixed.

Thanks for reporting!

Juan


Answer by Francis Martens (Exalate) on 28 October 2020

Hi Michel Bakker

Is this a visual or scripted connection?


Comments:

Michel Bakker commented on 28 October 2020

This is a scripted connection.

Francis Martens (Exalate) commented on 28 October 2020

Michel Bakker

Can you share the stack trace - it can be found in the details of the error

Michel Bakker commented on 29 October 2020

Sure, you can find it in the description.

Francis Martens (Exalate) commented on 29 October 2020

Could you run the following query against your Jira cloud

/rest/api/3/user/assignable/search?project=QGO

It will provide a list of all the users who are assignable on that project, including accountId’s

Then try
/rest/api/3/user/assignable/search?project=QGO&accountId=XXX

Where XXX is either an existing accountId or a bogus.
For the first type (existing accountId) it must return the user record. For the second type an id.

Please share the results without providing the details (or add them to the support ticket)
Is there anything outside the expected?

Michel Bakker commented on 30 October 2020

Result for an existing accountId:

[
    {
        "self": "https://***.atlassian.net/rest/api/3/user?accountId=***",
        "accountId": "***",
        "accountType": "atlassian",
        "emailAddress": "***@***",
        "avatarUrls": {
            "48x48": "***",
            "24x24": "***",
            "16x16": "***",
            "32x32": "***"
        },
        "displayName": "***",
        "active": true,
        "timeZone": "Europe/Amsterdam",
        "locale": "nl_NL"
    }
]

Result for a non-existing accountId:

[]

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.