We tried to get work log from Jira API. However, we found that certain work log throw wrong author name as the it's username.I found that in the app_user table, the user's user_key is the same as the author name so I changed that to be the same as current username.
However, it still doesn't update in the work log.
So the app_user.user_key field will match the username in JIRA when the account is first created in JIRA. But if that account has ever been renamed in JIRA, then the cwd_user table gets updated with the new values (along with the app_user.lower_user_name value) while the app_user.user_key field is expected to remain the same in JIRA, forever.
If you modified that field directly via SQL then I fear you might have messed with the way JIRA is storing that historical information such as worklogs and issue edit history.
But back to the worklog problem, I think you are seeing a known bug in JIRA JRASERVER-36642
The good news is that there is a workaround for this on that bug ticket:
Use the /rest/api/2/user endpoint to retrieve the user's username based on its key. This should return something like:
"displayName": "Matheus Fernandes",
It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs