# Email transform

**URL:** <https://developer.sailpoint.com/discuss/t/email-transform/65643>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security\
**Created:** [June 12, 2024, 2:38pm UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643 "2024-06-12T14:38:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![polaraojalligampala](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@polaraojalligampala](https://developer.sailpoint.com/discuss/u/polaraojalligampala)\
**Post date:** [June 12, 2024, 2:38pm UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/1 "2024-06-12T14:38:01Z")

</div>

I’m having difficulty creating a “transform” to use the mail attribute of a source (open)Condition : Populate Alternate email from DAP - if Email value is undefined then do not display anything otherwise dispaly the email.Here is I tied . can any one help me

---

<div class="post-metadata">

**Author:** ![baoussounda](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/baoussounda/32/13095_2.png) [@baoussounda](https://developer.sailpoint.com/discuss/u/baoussounda)\
**Post date:** [June 12, 2024, 2:52pm UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/2 "2024-06-12T14:52:18Z")

</div>

> [@polaraojalligampala](#):
>
> sonalEmail value is undefined the

Hi @polaraojalligampala,

Can you try this :

```auto
{
    "attributes": {
        "alternateEmail": {
            "attributes": {
                "sourceName": "openLDAP",
                "attributeName": "personalMail"
            },
            "type": "accountAttribute"
        },
        "value": "#if($alternateEmail && $alternateEmail!='')$alternateEmail#end"
    },
    "type": "static",
    "name": "Generate alternate Mail Transform-Sandbox"
}

```

---

<div class="post-metadata">

**Author:** ![jesvin90](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jesvin90/32/5301_2.png) [@jesvin90](https://developer.sailpoint.com/discuss/u/jesvin90)\
**Post date:** [June 12, 2024, 2:54pm UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/3 "2024-06-12T14:54:04Z")

</div>

Hi @polaraojalligampala,

You can make use of a simple first valid transform as below :

```auto
{
    "name": "Generate alternate Mail Transform-Sandbox",
    "type": "firstValid",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "attributeName": "personalMail",
                    "sourceName": "openLDAP"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "value": ""
                },
                "type": "static"
            }
        ]
    },
    "internal": false
}

```

---

<div class="post-metadata">

**Author:** ![ashutosh08](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ashutosh08/32/11459_2.png) [@ashutosh08](https://developer.sailpoint.com/discuss/u/ashutosh08)\
**Post date:** [June 13, 2024, 3:07am UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/6 "2024-06-13T03:07:35Z")

</div>

Hi @polaraojalligampala,

Try to use below given. Also, you can make changes in the first valid solution by addition of ignoreError and then try.

```auto
{
    "attributes": {
        "alternateEmail": {
            "attributes": {
                "ignoreErrors": "true",
                "values": [
                    {
                        "attributes": {
                            "sourceName": "openLDAP",
                            "attributeName": "personalMail"
                        },
                        "type": "accountAttribute"
                    },
                    {
                        "attributes": {
                            "value": "none"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid"
        },
        "value": "#if($alternateEmail!='none')$alternateEmail#end"
    },
    "type": "static",
    "name": "Email Transform"
}

```

If further help needed, then let me know.

Thanks

---

<div class="post-metadata">

**Author:** ![brennenscott](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/brennenscott/32/23642_2.png) [@brennenscott](https://developer.sailpoint.com/discuss/u/brennenscott)\
**Post date:** [June 13, 2024, 4:18am UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/7 "2024-06-13T04:18:57Z")

</div>

Expanding on @ashutosh08’s reply… there needs to be an `else` statement. With the current logic, if the user does not have an attribute for personalMail on the openLDAP source, the firstValid transform will result in `none` for `alternateEmail`. Then, the VTL logic will result in a null value.

Try one of these:

### FirstValid & Static

```auto
{
    "attributes": {
        "alternateEmail": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "attributeName": "personalMail",
                            "sourceName": "openLDAP"
                        },
                        "type": "accountAttribute"
                    },
                    "None"
                ]
            },
            "type": "firstValid"
        },
        "value": "#if($alternateEmail!='None')$alternateEmail#{else}None#end"
    },
    "type": "static",
    "name": "Email Transform"
}

```

### FirstValid Only

```auto
{
    "attributes": {
        "values": [
            {
                "attributes": {
                    "attributeName": "personalMail",
                    "sourceName": "openLDAP"
                },
                "type": "accountAttribute"
            },
            "None"
        ]
    },
    "type": "firstValid",
    "name": "Email Transform"
}

```

---

<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:** [August 12, 2024, 4:19am UTC](https://developer.sailpoint.com/discuss/t/email-transform/65643/8 "2024-08-12T04:19:51Z")

</div>

Closed on August 12, 2024, 4:19am UTC

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