Getting error in Exalate while syncing user "bill.o'neil@xxx.com"

We are doing a 1-way migration from Jira to Azure Devops.

The requirement is that we would also like to sync assignees from Jira to Azure.

The caviat here is that a few users like for ex bill.o’neil@xxx.com are unavailable in Azure hence can’t be synced directly as the Assignee so have a custom text field where we want to store this value.

For this reason we are doing a bit of filtering on the ADO Incoming like

if(replica.assignee)
{
if(replica.assignee.email == "bill.o'neil@xxx.com")
{
workItem."Jira Assignee" = replica.assignee.email
}
else
{
workItem."Jira Assignee" = replica.assignee.email
workItem.assignee = nodeHelper.getUserByEmail(replica.assignee.email, "PROJECT_KEY")
}
}

This still gives us an error like : Bad response when search User Entitlement By NameOrEmail: bill.o’neil@xxx.com - 500 - response body: Invalid filter: “name eq ‘bill.o’neil@xxx.com’”

How do we resolve this?

Thanks

The error you’re seeing (Invalid filter: “name eq ‘bill.o’neil@xxx.com’”) happens because Azure DevOps’ user search API doesn’t handle special characters (like apostrophes) in email addresses well. When you call nodeHelper.getUserByEmail(replica.assignee.email, "PROJECT_KEY") for a user that doesn’t exist in Azure DevOps, Exalate tries to look them up and the API fails due to the apostrophe.

To avoid this, you should only call nodeHelper.getUserByEmail if the user actually exists in Azure DevOps. For users who don’t exist, just store their email in your custom field and skip assigning them.

Here’s how you can adjust your Incoming sync script for Azure DevOps:

if (replica.assignee) {
  if (replica.assignee.email == "bill.o'neil@xxx.com") {
    workItem."Jira Assignee" = replica.assignee.email
    // Do NOT set workItem.assignee
  } else {
    workItem."Jira Assignee" = replica.assignee.email
    workItem.assignee = nodeHelper.getUserByEmail(replica.assignee.email, "PROJECT_KEY")
  }
}

This way, for users like “bill.o’neil@xxx.com” who don’t exist in Azure DevOps, you only set the custom field and avoid the API call that causes the error.

For more details on syncing assignees to custom fields, check the documentation:

Let me know if you need more help with the script logic!

Hi,

I did some testing and also tried to create a user with this email address but due to email address restrictions adding an apostrophee in the email isn’t really allowed unless we use a custom domain.

So this is what I did :

Hardcoded the email address in the Outgoing of Jira

replica.customKeys."assignee1"   = "exalate.o'test@gmail.com"

And did this in the Incoming of Azure

if(replica.customKeys."assignee1" && replica.customKeys."assignee1" == "exalate.o'test@gmail.com")
{
     workItem.description = replica.customKeys."assignee1"
  }
  else
  {
    workItem.assignee = nodeHelper.getUserByEmail(replica.customKeys."assignee1","Demo_Agile")
    workItem.description = replica.customKeys."assignee1"
  }

This logic worked fine for me, can you try something similar?

Thanks, Dhiren