Can we compare date identity attribute with current date?

Hello Experts,

image

This is an identity attribute that calculates the recent Active Directory Login, comparing ‘lastLogon’ and ‘lastLogonTimestamp’.

I want to compare comparelastlogons+10 days with current date. I have created a transform. Your advice will be very helpful to verify whatever I created is correct or not.

{
    "id": "removed",
    "name": "TestDateCompare",
    "type": "dateCompare",
    "attributes": {
        "firstDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "+10d",
                "roundUp": false,
                "input": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "identityAttribute",
                                "attributes": {
                                    "name": "comparelastlogons"
                                }
                            },
                            "9999-12-31T23:59:59Z"
                        ],
                        "ignoreErrors": false
                    }
                }
            }
        },
        "secondDate": {
            "type": "dateMath",
            "attributes": {
                "expression": "now",
                "roundUp": false
            }
        },
        "operator": "gt",
        "positiveCondition": "Yes",
        "negativeCondition": "No"
    },
    "internal": false
}

Thank you
Best Regards

Hi,

If you need to compare with 10 days you can do now-10d also in your second date. However the transform which you created looks ok.

Did you test it already?

-Abhinov

@Abhinov7 I tested it, it works fine. I wanted some experience eyes to look at it.
Do I need to convert the date to ISO8601 format before comparing? Is the null value handled correctly?

Hi,

I see you already converting it into ISO8601 format in “comparelastlogons” identity attribute. The transform you used for that identity attribute should handle the null.

And you added firstValid transform if the identity attribute is null, then taking edge case date.

Also you dont need ignoreErros in the transform.

Apart from these the transform looks good.

-Abhinov

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