# Date compare Help on 7 Day notification

**URL:** <https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, identity-security-cloud\
**Created:** [November 18, 2024, 8:44pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050 "2024-11-18T20:44:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![VBsupport](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@VBsupport](https://developer.sailpoint.com/discuss/u/VBsupport)\
**Post date:** [November 18, 2024, 8:44pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/1 "2024-11-18T20:44:59Z")

</div>

H everyone

I am trying to get a transform below to display the attribute “7-day mark?” - True so that we can fire off an offboarding workflow,

The attribute will not change when they date gets within the 7 days for some reason and not sure what is off. Can anyone 2nd eye this for me?

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/9/c/9c553e4bb804a4961078b207884c4cf1ba901240.png)

```json
  "id": "XXXXXX",
    "name": "7 Day End Mark"
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "inactivestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "identityAttribute",
                                        "attributes": {
                                            "name": "endDate"
                                        }
                                    },
                                    "inputFormat": "YYYY/MM/dd",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            {
                                "attributes": {
                                    "expression": "now+7d/d",
                                    "roundUp": false
                                },
                                "type": "dateMath"
                            }
                        ]
                    }
                },
                "operator": "LT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')true#{else}false#end"
    },
    "internal": false
}

```

---

<div class="post-metadata">

**Author:** ![VBsupport](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@VBsupport](https://developer.sailpoint.com/discuss/u/VBsupport)\
**Post date:** [November 18, 2024, 8:46pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/2 "2024-11-18T20:46:04Z")

</div>

AS you can see from the screen shot the data is within 2 days of the end of this account, so the field shout be marked true but it not transforming the field

---

<div class="post-metadata">

**Author:** ![sup3rmark](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sup3rmark/32/36229_2.png) [@sup3rmark](https://developer.sailpoint.com/discuss/u/sup3rmark)\
**Post date:** [November 18, 2024, 9:03pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/3 "2024-11-18T21:03:53Z")

</div>

it looks like your transform is taking an identity attribute called endDate (or now+7d, if endDate doesn’t exist?), and seeing if now \< that date. if so, “yes,” and return true, or “no” and return false.

this logic isn’t actually what you want to do. you’re failing to add 7 days to the end date to see if you’re actually more than 7 days past it.

try doing a date compare to see if `endDate` is less than `now-7d`.

also, you shouldn’t use identityAttributes in your transforms if you can avoid it. better to use account attributes.

---

<div class="post-metadata">

**Author:** ![Sachin\_Rajathadri](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sachin_rajathadri/32/6381_2.png) [@Sachin\_Rajathadri](https://developer.sailpoint.com/discuss/u/Sachin_Rajathadri)\
**Post date:** [November 18, 2024, 10:15pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/4 "2024-11-18T22:15:09Z")

</div>

Hi @VBsupport,

As Mark suggested, you need to do ‘date compare’. I have added a few steps to your transform, please give it a try,

```json
{
    "id": "XXXXXX",
    "name": "7 Day End Mark",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "inactivestate": {
            "attributes": {
                "operator": "gt",
                "positiveCondition": "yes",
                "negativeCondition": "no",
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "input": {
                                    "attributes": {
                                        "input": {
                                            "attributes": {
                                                "attributeName": "Provide end_DATE account attribute Name------",
                                                "sourceName": "Provide SourceName---------"
                                            },
                                            "type": "accountAttribute"
                                        },
                                        "inputFormat": "YYYY/MM/dd",
                                        "outputFormat": "ISO8601"
                                    },
                                    "type": "dateFormat"
                                },
                                "expression": "-7d/d",
                                "roundUp": false
                            },
                            "type": "dateMath"
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                }
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')true#{else}false#end"
    },
    "internal": false
}

```

Make sure to replace the account attribute name and the source name. Please let me know if this works.

---

<div class="post-metadata">

**Author:** ![vguleria](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vguleria/32/7884_2.png) [@vguleria](https://developer.sailpoint.com/discuss/u/vguleria)\
**Post date:** [November 19, 2024, 5:25am UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/5 "2024-11-19T05:25:16Z")

</div>

Hi @VBsupport

Please do not use the identity attribute for end date and use the account attribute instead. That should solve the issue in my opinion, although i must admit i did not check the whole transform.

I hope it helps.

Regards  
Vikas.

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [November 19, 2024, 8:53am UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/6 "2024-11-19T08:53:05Z")

</div>

> [@VBsupport](#):
>
> “inputFormat”: “YYYY/MM/dd”,

This doesn’t match the attribute format of dd/MM/YYYY. Fix that and that should solve your problem

---

<div class="post-metadata">

**Author:** ![VBsupport](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@VBsupport](https://developer.sailpoint.com/discuss/u/VBsupport)\
**Post date:** [November 19, 2024, 1:30pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/7 "2024-11-19T13:30:36Z")

</div>

Added the code above with changes to now query AD “account expires” however it is still showing “true” though the date is out 30 days. It should be “false” since the account is not within the 7 days of expire. I did also change the input to the below coming in from AD. These date math things are a pain

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/4/0/4051fcec52258ef19b2f43aa1dbc77ea7339eede.png)  
 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/4/d/4da41153806edddfd12352802643d18b612572af.png)

```json
{
    "id": "",
    "name": "End Date Notification Transform",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "inactivestate": {
            "attributes": {
                "operator": "gt",
                "positiveCondition": "yes",
                "negativeCondition": "no",
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "input": {
                                    "attributes": {
                                        "input": {
                                            "attributes": {
                                                "attributeName": "accountExpires",
                                                "sourceName": "ACTIVE DIRECTORY NON-EMPLOYEE ACCOUNT SOURCE"
                                            },
                                            "type": "accountAttribute"
                                        },
                                        "inputFormat": "MM/dd/YYYY'T'HH:mm",
                                        "outputFormat": "ISO8601"
                                    },
                                    "type": "dateFormat"
                                },
                                "expression": "now-7d/d",
                                "roundUp": false
                            },
                            "type": "dateMath"
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                }
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')true#{else}false#end"
    },
    "internal": false
}

```

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [November 19, 2024, 1:59pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/8 "2024-11-19T13:59:30Z")

</div>

> [@VBsupport](#):
>
> “inputFormat”: “MM/dd/YYYY’T’HH:mm”,

Still doesn’t match what the format of the source

---

<div class="post-metadata">

**Author:** ![Sachin\_Rajathadri](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sachin_rajathadri/32/6381_2.png) [@Sachin\_Rajathadri](https://developer.sailpoint.com/discuss/u/Sachin_Rajathadri)\
**Post date:** [November 19, 2024, 8:49pm UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/9 "2024-11-19T20:49:44Z")

</div>

Hi @VBsupport,

Could you please try this format,

```auto
   "attributes": {
       "attributeName": "accountExpires",
       "sourceName": "ACTIVE DIRECTORY NON-EMPLOYEE ACCOUNT SOURCE"
   },
   "type": "accountAttribute"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"

```

Also, keep the expression to `"-7d/d"` and not `"now-7d/d"`.

---

<div class="post-metadata">

**Author:** ![sagar\_kamalakar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sagar_kamalakar/32/18893_2.png) [@sagar\_kamalakar](https://developer.sailpoint.com/discuss/u/sagar_kamalakar)\
**Post date:** [November 22, 2024, 4:37am UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/10 "2024-11-22T04:37:01Z")

</div>

@VBsupport

Try this hope it helps

Note: Update sourceName and attributeName

```auto
{
    "id": "",
    "name": "End Date Notification Transform",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "inactivestate": {
            "attributes": {
                "firstDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "<Test-Employee>",
                                "attributeName": "<end_date>"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd",
                        "outputFormat": "ISO8601"
                    }
                },
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "dateMath",
                            "roundUp": true,
                            "attributes": {
                                "expression": "now+7d"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    }
                },
                "operator": "lte",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')true#{else}false#end"
    },
    "internal": false
}

```

---

<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:** [January 21, 2025, 4:37am UTC](https://developer.sailpoint.com/discuss/t/date-compare-help-on-7-day-notification/90050/11 "2025-01-21T04:37:32Z")

</div>

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