Query related to the assignee field

Question by: Neha N Pai

We are currently syncing tickets from JSM to Jira. But we would like assignee field to be populated in the service desk projects based on assignee from Jira. If the assignee in Jira is not an agent, then the field can remain blank, else it must be populated. We tried using the normal script for assignee field:

replica.assignee = issue.assignee
issue.assignee = replica.assignee

This throws an error whenever the Exalate fails to find the user to assign to the tickets or when the user does not have proper permissions in the project. Hence, we want to go with the mentioned solution. Please let me know if this is possible to achieve or if there are any alternatives to achieve this.

You can definitely achieve your goal by customizing your sync rules to only set the assignee if the user exists and is an agent in the JSM project. The error you’re seeing happens when Exalate tries to assign a user who either doesn’t exist or lacks the right permissions (like not being an agent).

Here’s how you can handle this in your Incoming sync script:

  1. Use nodeHelper.getUser to fetch the user by accountId (for Jira Cloud) or by email/username (for on-prem).
  2. Check if the user exists and is active.
  3. Optionally, check if the user is an agent (this part isn’t directly available in Exalate, but you can maintain a list of agent accountIds/emails and check against it).

Here’s a sample approach for Jira Cloud (adapt as needed for on-prem):

// List of agent accountIds (populate with your actual agent accountIds)
def agentAccountIds = [
  "accountid:12345",
  "accountid:67890"
]

def localAssignee = nodeHelper.getUser(replica.assignee?.key)
if (localAssignee && localAssignee.active && agentAccountIds.contains(localAssignee.key)) {
  issue.assignee = localAssignee
} else {
  issue.assignee = null // Leave unassigned if not an agent or not found
}
  • Replace agentAccountIds with the actual accountIds of your JSM agents.
  • This script ensures the assignee is only set if the user is both active and an agent; otherwise, the field remains blank.

You can find more details and examples in the Exalate documentation:

This approach should prevent errors and give you the control you need over the assignee field in your JSM projects.

Just checking out to understand if the suggested approach by AIDA helped out?