# Issue with FirstValid Transform

**URL:** <https://developer.sailpoint.com/discuss/t/issue-with-firstvalid-transform/5268>\
**Category:** SHF Discussion and Questions\
**Created:** [August 4, 2022, 6:33am UTC](https://developer.sailpoint.com/discuss/t/issue-with-firstvalid-transform/5268 "2022-08-04T06:33:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahak14](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@Mahak14](https://developer.sailpoint.com/discuss/u/Mahak14)\
**Post date:** [August 4, 2022, 6:33am UTC](https://developer.sailpoint.com/discuss/t/issue-with-firstvalid-transform/5268/1 "2022-08-04T06:33:29Z")

</div>

Hi,

I am trying to write a lifecycle state transform for workday source.

For the lifecycle state as Inactive , trying to write a transform on TERMINATION\_DATE . While using the firstValid transform as not all the Identities have TERMINATION\_DATE value, getting below error:

There was an exception while calculating the value for this attribute. java.time.format.DateTimeParseException: Text ‘{attributes={input=com.sailpoint.seaspray.transform.FirstValidTr…’ could not be parsed at index 0

Transform is as below:

```json
{
    "name": "Determine Workday LCS",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "activestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "WorkDay_Test"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "prehire": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+45d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "WorkDay_Test"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "onleave": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "attributeName": "ON_LEAVE",
                            "sourceName": "WorkDay_Test"
                        },
                        "type": "accountAttribute"
                    },
                    {
                        "attributes": {
                            "value": "none"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid"
        },
        "inactivestate": {
            "attributes": {
                "negativeCondition": "no",
                "positiveCondition": "yes",
                "firstDate": "now",
                "operator": "GT",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "values": [
                                    {
                                        "attributes": {
                                            "input": {
                                                "attributes": {
                                                    "attributeName": "TERMINATION_DATE",
                                                    "sourceName": "WorkDay_Test"
                                                },
                                                "type": "accountAttribute"
                                            },
                                            "inputFormat": "MM/dd/yyyy",
                                            "outputFormat": "ISO8601"
                                        },
                                        "type": "dateFormat"
                                    },
                                   "NA" 
                                ],
                                "ignoreErrors": "true"
                            },
                            "type": "firstValid"
                        }
                    }
                }
            },
            "type": "dateCompare"
        },
        "value": "#if(($inactivestate == 'no' || $inactivestate != 'NA') && $activestate == 'yes' && ($onleave == 'none' || $onleave == '0'))active#elseif($activestate == 'no' && $prehire == 'yes' && $onleave != '1')prehire#elseif($onleave == '1')leaveOfAbsence#elseif($inactivestate == 'yes')inactive#{else}UNKNOWN#end"
    }
}

```

Please help to resolve this asap.

---

<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:** [August 4, 2022, 6:50pm UTC](https://developer.sailpoint.com/discuss/t/issue-with-firstvalid-transform/5268/2 "2022-08-04T18:50:26Z")

</div>

The issue might be that you are trying to perform a `dateFormat` on an attribute that might be null, hence the exception error you are getting. Try running `firstValid` on your `TERMINATION_DATE` without the `dateFormat`. Then run a `conditional` that will return the formatted date **IF** the `TERMINATION_DATE` is not `NA`, else it will return `NA`.

---

<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:23pm UTC](https://developer.sailpoint.com/discuss/t/issue-with-firstvalid-transform/5268/3 "2023-07-19T14:23:24Z")

</div>

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


