Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Unable to populate username in the user-picker field based on the name available on the work-item su

Unable to populate username in the user-picker field based on the name available on the work-item su

Samuel Srungarapati November 2, 2025

Dear team,

When a Jira work-items get created, we get a username in the summary.

Using expressions, I was able to get the username out of it and was able to put the name on a text type customfield.

However, when I try to put this info in the single-User-picker field (customfield_20095), it fails despite my logs show that this field is updated.

2025-11-02 15:46:39.781 INFO - PUT /rest/api/3/issue/SAT-2 asObject Request Duration: 417ms 2025-11-02 15:46:39.781 INFO - Updated customfield_20095 on SAT-2 with value: [name:sxxx sxxxx]

Method: findJiraUserIdByEmail + updateField with accountId

def findJiraUserIdByEmail(String email) {
def resp = get("/rest/api/3/user/search")
.queryString("query", email)
.asObject(List)
if (resp.status != 200 || !resp.body) {
logger.warn("Jira user search failed for ${email}")
return null
}
def user = resp.body.find { it.emailAddress?.equalsIgnoreCase(email) }
if (!user) {
logger.warn("Jira user not found for email: ${email}")
return null
}
logger.info("Found Jira user: ${user.displayName} (${user.accountId})")
return user.accountId
}


and

def updateField(String key, String fieldId, def value) {
def payload = [fields: [(fieldId): value]]
def resp = put("/rest/api/3/issue/${key}")
.header("Content-Type", "application/json")
.body(payload)
.asObject(Map)
if (resp.status in [200, 204]) {
logger.info("Updated ${fieldId} on ${key}")
} else {
logger.error("Failed to update ${fieldId}: ${resp.status} | ${resp.body}")
}
}

Is there a way around to fix this?

 

Kind regards,

Samuel.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events