Date Compare transform

Hello Experts,
I have created below DataCompare Transform. But getting the null error

I am comparing ADLastLogOn+50 days with today.

adLastLogon is an Identity Attribute that has been modified to this format
yyyy-MM-dd

If ADLastLogOn+50 days is less than or equals to today.
Could anybody tell me what am I doing wrong here?

{
    "id": "",
    "name": "Test-DateCompare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "+50d",
                "roundUp": false,
                "input": {
                    "type": "dateFormat",
                    "attributes": {
                        "inputFormat": "yyyy-MM-dd",
                        "outputFormat": "ISO8601",
                        "input": {
                            "attributes": {
                                "name": "adLastLogon"
                            },
                            "type": "identityAttribute"
                        }
                    }
                }
            }
        },
        "secondDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "now",
                "roundUp": false
            },
            "operator": "lte",
            "positiveCondition": "yes",
            "negativeCondition": "No"
        }
    },
    "internal": false
}

Thank you

Hi @j1241 ,
I suggest you to :

  1. add firstValid Transform to handle any Null values first.
  2. Apart from this confirm the date format of the AD attribute that you are using.

As a reference you can follow this transform as example written by @sup3rmark : Find Latest Date Transform

Hope this Helps!

2 Likes

The primary issue here is that you have your operator, positivecondition, and negativeCondition inside of the secondDate object. They should be outside of that, but still within the attributes object.

There’s a more general issue of using the adLastLogon attribute to determine whether an account is still in-use. As @gourab mentioned, I have shared a transform previously that addresses those issues and should be ready to drop right into any environment using an Active Directory source and an Entra ID source.

1 Like

Thank you @sup3rmark and @gourab

I considered both of your suggestion and made it work.

Here is the corrected version:

{
    "id": "",
    "name": "Test-DateCompare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "+50d",
                "roundUp": false,
                "input": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "firstValid",
                            "attributes": {
                                "values": [
                                    {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "lastLogonTimestamp",
                                            "sourceName": "Active Directory Prod"
                                        }
                                    }
                                ]
                            }
                        },
                        "inputFormat": "EPOCH_TIME_WIN32",
                        "outputFormat": "ISO8601"
                    }
                }
            }
        },
        "secondDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "now",
                "roundUp": false
            }
        },
        "operator": "lte",
        "positiveCondition": "yes",
        "negativeCondition": "no"
    },
    "internal": false
}
1 Like

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