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

**URL:** <https://forum.library.adaptavist.com/t/how-can-i-use-the-result-of-gethasheduserkey-in-the-addusertoorganization-event/535>\
**Category:** ScriptRunner\
**Tags:** data-center, jira, listener\
**Created:** [November 18, 2024, 9:43pm UTC](https://forum.library.adaptavist.com/t/how-can-i-use-the-result-of-gethasheduserkey-in-the-addusertoorganization-event/535 "2024-11-18T21:43:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattd](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mattd](https://forum.library.adaptavist.com/u/mattd)\
**Post date:** [November 18, 2024, 9:43pm UTC](https://forum.library.adaptavist.com/t/how-can-i-use-the-result-of-gethasheduserkey-in-the-addusertoorganization-event/535/1 "2024-11-18T21:43:05Z")

</div>

The `getHashedUserKey()` method on the `AddUserToOrganization` event returns the `hashCode()`ed result of the Jira User key. I’m wondering how I can use this in a Custom Listener to get the actual User Key of the Jira user added to the Organization?

Here are the properties available, with the hashedUserKey example:

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

---

<div class="post-metadata">

**Author:** ![nikolayr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.library.adaptavist.com/nikolayr/32/254_2.png) [@nikolayr](https://forum.library.adaptavist.com/u/nikolayr)\
**Post date:** [November 19, 2024, 11:38am UTC](https://forum.library.adaptavist.com/t/how-can-i-use-the-result-of-gethasheduserkey-in-the-addusertoorganization-event/535/2 "2024-11-19T11:38:12Z")

</div>

Hi Matt,  
hashing is the way to convert the string into an integer, and that integer is known as the hash of a string. String hashing is used to compare two strings whether they are equal or not.  
This means in order to find user in Organization by hash, you would need to have a List of all users hashes.

---

<div class="post-metadata">

**Author:** ![mattd](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mattd](https://forum.library.adaptavist.com/u/mattd)\
**Post date:** [November 19, 2024, 12:50pm UTC](https://forum.library.adaptavist.com/t/how-can-i-use-the-result-of-gethasheduserkey-in-the-addusertoorganization-event/535/3 "2024-11-19T12:50:58Z")

</div>

Thanks nikolayr, that’s exactly what I ended up doing: 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.

Thank you!
