Date compare Help on 7 Day notification

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?

  "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
}

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

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.

4 Likes

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,

{
    "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.

1 Like

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.

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

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


{
    "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
}

Still doesn’t match what the format of the source

Hi @VBsupport,

Could you please try this format,

   "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".

@VBsupport

Try this hope it helps

Note: Update sourceName and attributeName

{
    "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
}

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