Transform - Return null/empty string

On the examples for FirstValid some of the options are “none” or “” if the other options are not found. I can get “none” to work but what I want is for there to be no value. When I use “” I get a transform error.

For example:

{
   "attributes":{
      "values":[
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"Active Directory"
            },
            "type":"accountAttribute"
         },
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"FAST Active Directory"
            },
            "type":"accountAttribute"
         },
         "none"
      ]
   },
   "id":"Common - distinugishedName",
   "type":"firstValid"
}

VS

{
   "attributes":{
      "values":[
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"Active Directory"
            },
            "type":"accountAttribute"
         },
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"FAST Active Directory"
            },
            "type":"accountAttribute"
         },
         ""
      ]
   },
   "id":"Common - distinugishedName",
   "type":"firstValid"
}

Hi – Please try adding ignoreErrors: true to the firstValid transform so it doesn’t have null pointer exceptions. Please try this:

{
   "attributes":{
      "ignoreErrors":"true",
      "values":[
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"Active Directory"
            },
            "type":"accountAttribute"
         },
         {
            "attributes":{
               "attributeName":"distinguishedName",
               "sourceName":"FAST Active Directory"
            },
            "type":"accountAttribute"
         },
         ""
      ]
   },
   "name":"Common - distinugishedName",
   "type":"firstValid"
}
1 Like

In case you are supplying the output of this transform to other transform it’s advisable to have some kind of string instead of blank value. That’s sole purpose of firstValid. If you are directly using this transform then it should work. Try ignoreErrors as mentioned above but only if you are using stand alone transform and not passing output of this transform to other transform. Using ignoreErrors won’t serve the purpose there.

Is there a way to have a Transform actually return null instead of an empty string? For example, if we assign a transform to an Identity Attribute, we would want that Identity Attribute unset rather than set with a null string.

The use case for this is for Account Sync: in some cases we want Account Sync to remove the account attribute, not set it to an empty string.

HI Chirag
I am in the situation you describe.
If value is blank how do i get a transform to ignore?
i want to use middle name to get DN but not everyone has a middle name populated.

Hi,

I’m using a nested transform. I’m checking an attribute : work_telephone. Not all users have the value on this attribute. So i there an option to add exception so that transforms ignore checking the users who has no value. and check the users who has value and perform the transform.

Are you using condition transform something like below still working on it

{
  "attributes": {
    "expression": "middleNameRevised eq *",
    "positiveCondition": "$wmiddlename",
    "negativeCondition": "$nmiddlename",
    "department": {
      "attributes": {
        "sourceName": "HR Source",
        "attributeName": "department"
      },
      "type": "accountAttribute"
    },
    "wmiddlename": {
      "patterns": [
        "CN=$firstName $middleName $lastName,$ouPath",
        "CN=$firstName $middleName $lastName${uniqueCounter},$ouPath"
                    ],
    },
    "nmiddlename": { 
	"patterns": [
        "CN=$firstName $lastName,$ouPath",
        "CN=$firstName $lastName${uniqueCounter},$ouPath"
                    ],
  },
  "type": "conditional",
}

@peter_muchangi

Could you let me know from what value you have in middleNameRevised? used in the expression.

I have retrieved it from HRMS Middle_Name. Sometimes its blank