# Transform - Return null/empty string

**URL:** <https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703>\
**Category:** SHF Discussion and Questions\
**Created:** [October 1, 2021, 6:31pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703 "2021-10-01T18:31:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethompson](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ethompson/32/17298_2.png) [@ethompson](https://developer.sailpoint.com/discuss/u/ethompson)\
**Post date:** [October 1, 2021, 6:31pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/1 "2021-10-01T18:31:36Z")

</div>

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.

> **[First Valid | SailPoint Developer Community](https://developer.sailpoint.com/idn/docs/transforms/operations/first-valid)**
>
> Return the first piece of data that is not null.

For example:

```auto
{
   "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

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

```

---

<div class="post-metadata">

**Author:** ![lisa\_ivy](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lisa\_ivy](https://developer.sailpoint.com/discuss/u/lisa_ivy)\
**Post date:** [October 1, 2021, 6:46pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/2 "2021-10-01T18:46:56Z")

</div>

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

```auto
{
   "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"
}

```

---

<div class="post-metadata">

**Author:** ![cpatel](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@cpatel](https://developer.sailpoint.com/discuss/u/cpatel)\
**Post date:** [October 4, 2021, 6:25am UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/3 "2021-10-04T06:25:20Z")

</div>

> [@ethompson](#):
>
> to work but what I want is for there to be no value. When I use “” I get a transform error.
> 
> [https://developer.sailpoint.com/idn/docs/transforms/operations/first-valid/](https://developer.sailpoint.com/idn/docs/transforms/operations/first-valid/)

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.

---

<div class="post-metadata">

**Author:** ![brad\_grutsch](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brad\_grutsch](https://developer.sailpoint.com/discuss/u/brad_grutsch)\
**Post date:** [October 7, 2021, 2:53pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/4 "2021-10-07T14:53:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peter\_muchangi](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@peter\_muchangi](https://developer.sailpoint.com/discuss/u/peter_muchangi)\
**Post date:** [November 7, 2022, 10:15am UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/5 "2022-11-07T10:15:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chandramohan2706](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chandramohan2706](https://developer.sailpoint.com/discuss/u/chandramohan2706)\
**Post date:** [November 7, 2022, 1:59pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/6 "2022-11-07T13:59:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peter\_muchangi](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@peter\_muchangi](https://developer.sailpoint.com/discuss/u/peter_muchangi)\
**Post date:** [November 7, 2022, 5:30pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/7 "2022-11-07T17:30:32Z")

</div>

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

```auto
{
  "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",
}

```

---

<div class="post-metadata">

**Author:** ![chandramohan2706](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@chandramohan2706](https://developer.sailpoint.com/discuss/u/chandramohan2706)\
**Post date:** [November 8, 2022, 7:22am UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/8 "2022-11-08T07:22:08Z")

</div>

@peter_muchangi

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

---

<div class="post-metadata">

**Author:** ![peter\_muchangi](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@peter\_muchangi](https://developer.sailpoint.com/discuss/u/peter_muchangi)\
**Post date:** [November 8, 2022, 11:54am UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/9 "2022-11-08T11:54:39Z")

</div>

I have retrieved it from HRMS Middle\_Name. Sometimes its blank

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:22pm UTC](https://developer.sailpoint.com/discuss/t/transform-return-null-empty-string/1703/10 "2023-07-19T14:22:08Z")

</div>

Closed on July 19, 2023, 2:22pm UTC


