Setting User field using jira API

I have been able to find various questions similar to this one, but none of them are solving this problem.

So I have this custom field

“customfield_10039”: {

          "required": false,

          "schema": {

            "type": "user",

            "custom": "com.atlassian.jira.plugin.system.customfieldtypes:userpicker",

            "customId": 10039

          },

          "name": "user",

          "key": "customfield_10039",

          "autoCompleteUrl": "https://integrationtr.atlassian.net/rest/api/1.0/users/picker?fieldName=customfield_10039&fieldConfigId=10140&projectId=10001&showAvatar=true&query=",

          "hasDefaultValue": false,

          "operations": [

            "set"

          ]

        },

So as you can see this allows one to set the user, now I set the user using this:

{“fields”:{“customfield_10039” : {“name”:“admin”}}}

I have tried so many combinations for name, I have tried using email id, display name, even name by concatenating first name, second name. In each one I get the same error:

{“errorMessages”:,“errors”:{“customfield_10039”:“user is required.”}}

Are you absolutely 100% sure you’re on Jira SERVER, as per the tag you’ve added to your question, and not Jira CLOUD?

https://integrationtr.atlassian.net/ sure looks like a URL for a Jira CLOUD site to me.

Oh my bad, this is indeed cloud, but would it matter for the question though ?

Yes, because with Jira Cloud the use of user names / keys was deprecated years ago. You must use the user’s account ID (accountId).

Ohh, thanks a lot man
Have been struggling with this a lot.