# Jira on-premise: User from Database Picker custom field to Assignee field

**URL:** <https://community.exalate.com/t/jira-on-premise-user-from-database-picker-custom-field-to-assignee-field/4987>\
**Category:** General Questions\
**Tags:** onpremise-jira, exalate, usecase, migrated\_question, assignee\
**Created:** [November 4, 2024, 7:36am UTC](https://community.exalate.com/t/jira-on-premise-user-from-database-picker-custom-field-to-assignee-field/4987 "2024-11-04T07:36:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:36am UTC](https://community.exalate.com/t/jira-on-premise-user-from-database-picker-custom-field-to-assignee-field/4987/1 "2024-11-04T07:36:26Z")

</div>

_Originally asked by Dmitrij POPOV on 21 December 2021 [(original question)](https://oldcommunity.exalate.com/questions/42829968)_

* * *

**Context:**

1. Synchronisation Jira on-premise A to Jira on-premise B.
2. On A side Single choice Database Picker cf “AssigneeJIRASW” is connected to side’s B users DataBase.
3. During the synchronisation, the value from cf “AssigneeJIRASW” of side A need to fill-in the value of “Assignee” field on the destination B side.

**Problem:**

- Single choice Database Picker return a Json String value instead of a simple String

**Solutions:**

_Without JIRA API imports:_

```auto
/* firtssyncs and other fields syncs */

// CF "AssigneeJIRASW" to target "Assignee" field
String AssigneeJIRASW = replica.customFields."AssigneeJIRASW".value?.getAsString()

def defaultUser = nodeHelper.getUserByEmail("default.user@idalko.com")
if (AssigneeJIRASW) {
    issue.assignee = nodeHelper.getUserByEmail(AssigneeJIRASW) 
} else {
    issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: defaultUser
}
issue.reporter = nodeHelper.getUserByEmail(replica.reporter?.email) ?: defaultUser

```

_With JIRA API imports:_

```auto
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager

/* firtssyncs and other fields syncs */

// CF "AssigneeJIRASW" to target "Assignee" field
def issueSR = ComponentLocator.getComponent(IssueManager).getIssueObject(replica.key)
def cField = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("AssigneeJIRASW")
def cFieldValue = issueSR.getCustomFieldValue(cField)

def defaultUser = nodeHelper.getUserByEmail("default.user@idalko.com")
if(cFieldValue) {
    issue.assignee = nodeHelper.getUserByEmail(cFieldValue)
} else {
    issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: defaultUser
}
issue.reporter = nodeHelper.getUserByEmail(replica.reporter?.email) ?: defaultUser

```

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:36am UTC](https://community.exalate.com/t/jira-on-premise-user-from-database-picker-custom-field-to-assignee-field/4987/2 "2024-11-04T07:36:27Z")

</div>

_Answer by Dmitrij POPOV on 21 December 2021_

**Single choice Database Picker cf “AssigneeJIRASW” custom field configuration:**

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/7aa14b6787509cb3d0050c6947772b76597fe408.png)

* * *
