The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the result of getHashedUserKey() in the AddUserToOrganization Event in ScriptRunner?

Matt Donnelly
November 18, 2024

JSM 5.12.5, ScriptRunner 8.34.0

Edit: I understand now that it's the result of applying hashCode() on the user key, but I still don't understand how this is useful.

I want to get the Customer (Jira User) that was just added to an Organization in JSM via the AddUserToOrganization event on a Custom Listener in ScriptRunner.

There is a promising-looking method on the event binding called getHashedUserKey(): how can I use this? How can I "unhash" it back to useable data? It looks like this, shown with the other available properties:

class="class com.atlassian.servicedesk.internal.feature.organization.analytics.AddUserToOrganizationEvent" hashedUserKey="-1796255073" organisationId="161" sdVersion="5.12.5"

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Matt Donnelly
November 18, 2024

My workaround: I made an API call to Get Users in Organization (/rest/servicedeskapi/organization/{organizationId}/user) using the organisationId passed back by the event and and matched the hashedUserKey against the hashCode()ed keys of all the users in the Organization.

Not sure why the event doesn't just pass back a normal Jira User key instead of a hash?

DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events