Compare Timestamp with Is Before X Days in the Future in Custom Workflow in ISC not working

Hi Expert Team,

We have a requirement to send reminders to the reviewee in the Access Certification process as outlined below for a 15-day review period:

  • Day 0 – Initiation

  • Day 5 – 2nd Reminder

  • Day 10 – 3rd Reminder

  • Day 15 – Closure Reminder

To implement this requirement, we are attempting to compare timestamps to determine how many days remain until the certification deadline. However, the condition is consistently evaluating to false

TestforDateDuein5days20260225.json (1.9 KB)

.

I have attached the workflow for your reference. Could someone please assist in reviewing the date comparison logic? This is a high-priority requirement, and your support would be greatly appreciated.

Cheers,

VJ

Hi @Hanushma

Based on the WF you shared, seems like there’s a typo in the variable defined to store certification deadline. I see in Define Variable step name is “CertDeadLine”, however in Compare Timestamps it is used as $.defineVariable.certDeadLine

Have you validated the workflow execution input for Compare Timestamps step, is it having correct value in each variable? Also, I see you are storing current date in Define Variable to change its format. Although. Compare Timestamps require ISO8601 format date in Value2, you can directly use $.now() in Value2

Hi Priya,

When I did the test workflow, the value i the output for Certification deadline is correct. Regarding the current date format, I have changed the Current date format to match the CertDeadline date format. My requiremnt is to compare only dates hence trying to format Certdeadline and current date with timestamp as 00:00:00 so that it can compare only dates.

Cheers,VJ

Regards,

Hanushma

@Hanushma- Try to use “Date Formatter” in operators under Define Variable there you’ll get your required format

Hi VJ,

I think the issue stems from your dates not being in ISO8601 format - if you use $.now() in your define variable, you will see that the suffix should be T00:00:00.000Z

Try the below

{
    "name": "Test for Date Due in 5 days",
    "description": "",
    "definition": {
        "start": "Define Variable",
        "steps": {
            "Compare Timestamps": {
                "actionId": "sp:compare-timestamps",
                "choiceList": [
                    {
                        "comparator": "TimestampLessThanEqualsXDayFuture",
                        "nextStep": "End Step - Success",
                        "variableA.$": "$.defineVariable.certDeadLine",
                        "variableB": "1"
                    }
                ],
                "defaultStep": "End Step - Failure",
                "displayName": "",
                "type": "choice"
            },
            "Define Variable": {
                "actionId": "sp:define-variable",
                "attributes": {
                    "id": "sp:define-variable",
                    "variables": [
                        {
                            "description": "",
                            "name": "currentdate",
                            "transforms": [
                                {
                                    "id": "sp:transform:replace:string",
                                    "input": {
                                        "pattern": "T.*",
                                        "replacement": "T00:00:00.000Z"
                                    }
                                }
                            ],
                            "variableA.$": "$.now()"
                        },
                        {
                            "description": "",
                            "name": "CertDeadLine",
                            "transforms": [
                                {
                                    "id": "sp:transform:replace:string",
                                    "input": {
                                        "pattern": "T.*",
                                        "replacement": "T00:00:00.000Z"
                                    }
                                }
                            ],
                            "variableA.$": "$.trigger.campaign.deadline"
                        },
                        {
                            "description": "",
                            "name": "now",
                            "transforms": [],
                            "variableA.$": "$.now()"
                        }
                    ]
                },
                "displayName": "Current date - Define Variable",
                "nextStep": "Compare Timestamps",
                "type": "Mutation"
            },
            "End Step - Failure": {
                "actionId": "sp:operator-failure",
                "displayName": "",
                "failureName": "Comparison failed",
                "type": "failure"
            },
            "End Step - Success": {
                "actionId": "sp:operator-success",
                "displayName": "",
                "type": "success"
            }
        }
    },
    "enabled": false,
    "executionCount": 0,
    "failureCount": 0,
    "trigger": {
        "type": "EVENT",
        "attributes": {
            "id": "idn:campaign-activated"
        }
    }
}

Hi @Hanushma ,

Your current workflow is trying to compare if a deadline is exactly 5, 10, or 15 days away, but the timestamp comparison operators work differently than expected for “days remaining” calculations.

Try this instead

{
    "name": "Test for Date Due in 5 days",
    "description": "Test for Date Due in 5 days",
    "definition": {
        "start": "Get Certification Campaign",
        "steps": {
            "Get Certification Campaign": {
                "actionId": "sp:get-campaign",
                "attributes": {
                    "id.$": "$.trigger.campaign.id"
                },
                "nextStep": "Compare Timestamps",
                "type": "action",
                "versionNumber": 1
            },
            "Compare Timestamps": {
                "choiceList": [
                    {
                        "comparator": "TimestampLessThanEqualsXDayFuture",
                        "nextStep": "Compare Timestamps 2",
                        "variableA.$": "$.getCertificationCampaign.deadline",
                        "variableB": 5
                    }
                ],
                "defaultStep": "End Step - Success",
                "type": "choice"
            },
            "Compare Timestamps 2": {
                "choiceList": [
                    {
                        "comparator": "TimestampGreaterThanEqualsXDayFuture",
                        "nextStep": "Send Email",
                        "variableA.$": "$.getCertificationCampaign.deadline",
                        "variableB": 5
                    }
                ],
                "defaultStep": "End Step - Success",
                "type": "choice"
            },
            "Send Email": {
                "actionId": "sp:send-email",
                "attributes": {
                    "body": "Test",
                    "context": {},
                    "recipientEmailList": "test@sailpoint.com",
                    "subject": "Test"
                },
                "nextStep": "End Step - Success",
                "type": "action",
                "versionNumber": 2
            },
            "End Step - Success": {
                "type": "success"
            }
        }
    },
    "trigger": {
        "type": "EVENT",
        "attributes": {
            "id": "idn:campaign-activated"
        }
    }
}