Skip to content
Try For Free

How to handle Null values in the Email Address user attribute

Problem:

We have the UserSync "Email Address" attribute mapped to a custom IdP attribute which does not always have a value for users, but we want those users to be added to the UserSync directory in our Atlassian product anyway. 

We would like UserSync to add/update users regardless of whether ATTR_EMAIL has a value or not. 


Solution:

There are three ways to proceed with to fix this:

  1. The optimum and recommended fix is to solve this from the IdP side. I.e. always have a value in the attribute mapped to the Email Address for all the users.

  2. Use another attribute for the Email Address (such as mail or UPN for example) as a fallback when the first attribute is null, and add two transformation rules with regular expressions to either use the first attribute or uses the second one if the first one doesn't have a value.
    In that case, you would need to add those two attributes in the Email Address attribute mapping field between curly brackets and separated by a comma. It should look like the following:
    Email Address: {firstAttribute},{secondAttribute}
    US_EmailAttr_2mailAttr.png
    Then add the below two transformation rules to the Email Address:

    • Regular Expression: (.*\S),.*
      Replacement: $1

    • Regular Expression: .*,(.*\S)
      Replacement: $1
      US_email_transformation_rules.png

  3. Use a default value for the email address like "no-reply@domain.com" as a fallback when the email attribute you're using does not have a value.
    In that case, the Email Address attribute mapping field should look like the following:
    Email Address: {firstAttribute},no-reply@domain.com
    US_EmailAttr_defaulMail.png
    Add the below two transformation rules to the Email Address:

    • Regular Expression: (.*\S),.*
      Replacement: $1

    • Regular Expression: .*,(.*\S)
      Replacement: $1
      US_email_transformation_rules.png