# Workflows: How to default to an empty string for empty identity attribute?

**URL:** <https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, identity-security-cloud\
**Created:** [April 26, 2024, 2:05pm UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289 "2024-04-26T14:05:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamian](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@adamian](https://developer.sailpoint.com/discuss/u/adamian)\
**Post date:** [April 26, 2024, 2:05pm UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289/1 "2024-04-26T14:05:28Z")

</div>

Hi all,

I want to send an email using the workflow. Not all identity attributes may be set, and I want them to be displayed as empty string in the e-mail if they are not set.

Body of e-mail: `${title} ${titlex}`  
Templating Context:

```auto
{
  "title.$":"$.getJoinerIdentity.attributes[?(@.title)].title",
  "titlex.$":"$.getJoinerIdentity.attributes.title"
}

```

The input.body.context for the Send Email step as visible in the “Text Execution”:

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/b/b80a510f35c57949282311e6ca363eeda0b0ef3d.png)

E-mail Result: `${title} {$titlex}`  
Expected e-mail result: ` `

I am sure I’m missing something obvious on how to solve this issue.

Best regards,  
Andrei

---

<div class="post-metadata">

**Author:** ![Shanmukh](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Shanmukh](https://developer.sailpoint.com/discuss/u/Shanmukh)\
**Post date:** [April 26, 2024, 2:59pm UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289/2 "2024-04-26T14:59:12Z")

</div>

Hi @adamian,

In the email body of your “send email” workflow step, you can use velocity script’s if-else condition.

For example: if you want to check when string value is not null `#if(${title}) ${title} ${titlex} #else (your else condition if any) #end`

If you want to check when string is null `#if(!${title}) ${title} ${titlex} #else (your else condition if any) #end`

Hope this works for you.

Thank you.  
Shanmukh Gali

---

<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 26, 2024, 7:01pm UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289/3 "2024-04-26T19:01:09Z")

</div>

I think @Shanmukh has the correct answer here. The workflow email step supports [apache velocity](https://velocity.apache.org/engine/2.0/user-guide.html) similar to how [email templates](https://documentation.sailpoint.com/saas/help/common/emails/using_email_templates.html) do.

---

<div class="post-metadata">

**Author:** ![adamian](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@adamian](https://developer.sailpoint.com/discuss/u/adamian)\
**Post date:** [April 29, 2024, 6:53am UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289/4 "2024-04-29T06:53:57Z")

</div>

Thanks @Shanmukh, ~~I’ll try this~~ this works (with both `title` and `titlex`).

This doesn’t work in the `static` transform (which also uses Apache Velocity), so I didn’t think this could work here.

---

<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:** [June 28, 2024, 6:54am UTC](https://developer.sailpoint.com/discuss/t/workflows-how-to-default-to-an-empty-string-for-empty-identity-attribute/54289/5 "2024-06-28T06:54:40Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
