# Empty Variables in Veloctiy

**URL:** <https://developer.sailpoint.com/discuss/t/empty-variables-in-veloctiy/471>\
**Category:** SHF Discussion and Questions\
**Created:** [April 30, 2021, 2:01pm UTC](https://developer.sailpoint.com/discuss/t/empty-variables-in-veloctiy/471 "2021-04-30T14:01:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![justinrhaines](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/justinrhaines/32/16564_2.png) [@justinrhaines](https://developer.sailpoint.com/discuss/u/justinrhaines)\
**Post date:** [April 30, 2021, 2:01pm UTC](https://developer.sailpoint.com/discuss/t/empty-variables-in-veloctiy/471/1 "2021-04-30T14:01:01Z")

</div>

I am using a transform to get an attribute value from a source (e.g. Company from UltiPro) and then using if/else velocity statements based on the value in that field. If the user’s source is NELM rather than UltiPro, that value is empty but the velocity errors out. Other than using a firstValid on the Company variable, is there an easier way to handle blank values?

{  
“attributes”: {  
“Company”: {  
“attributes”: {  
“attributeName”: “Company”,  
“sourceName”: “UltiPro API”  
},  
“type”: “accountAttribute”  
},  
“value”: “#if($Company==‘acme’)@acme.com#{else}@othercompany.com#end”  
},  
“id”: “Email Domain”,  
“type”: “static”  
}

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [April 30, 2021, 3:55pm UTC](https://developer.sailpoint.com/discuss/t/empty-variables-in-veloctiy/471/2 "2021-04-30T15:55:43Z")

</div>

`firstValid` is the best solution for correcting null values. Here is a simple example that will look for a `mail` attribute from AD, and if it is not available it will use the static string value `none`.

```nohighlight
{
  "id": "Determine Email",
  "type": "lower",
  "attributes": {
    "input": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "attributes": {
              "attributeName": "mail",
              "sourceName": "Active Directory"
            },
            "type": "accountAttribute"
          },
          {
            "attributes": {
              "value": "none"
            },
            "type": "static"
          }
        ]
      }
    }
  }
}

```

---

<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:21pm UTC](https://developer.sailpoint.com/discuss/t/empty-variables-in-veloctiy/471/3 "2023-07-19T14:21:50Z")

</div>


