DateMath transform not working for EndDate-1

Hi members

Greeting of the day.

Please help me to resolve this issue as I have explored the developer forum but didn’t get the information.

I am currently working on one DateMath transform but unable to get the required output.

Requirement:
Input:
End Date: 7/6/2023 0:0:0 AM UTC

Output:

7/5/2023 (One day before the End date)
Developed Transform:

{
    "id": "a16424f8-05f0-4f09-9642-b51e9ad266d8",
    "name": "Date Math Transform",
    "type": "dateMath",
    "attributes": {
        "expression": "+12d/d",
        "roundUp": true,
        "input": {
            "attributes": {
                "input": {
                    "attributes": {
                        "sourceName": "SAP HR DB- DEV (SAPUsers)",
                        "attributeName": "FiredDate"
                    },
                    "type": "accountAttribute"
                },
                "inputFormat": "MM/dd/yyyy HH:mm:ss a Z",
                "outputFormat": "PEOPLE_SOFT"
            },
            "type": "dateFormat"
        }
    },
    "internal": false
}

Hi @mabhavsa, as mentioned in this documentation - Date Math | SailPoint Developer Community, the input datetime value must always be in ISO8601 format. However, seeing from your script, I see you are applying the dateMath operation on the PEOPLE_SOFT format from the input value.

I have tweaked the script as follows:

{
    "name": "Date Math Transform",
    "type": "dateFormat",
    "attributes": {
        "input": {
            "attributes": {
                "expression": "-1d",
                "input": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "sourceName": "SAP HR DB- DEV (SAPUsers)",
                                "attributeName": "FiredDate"
                            },
                            "type": "accountAttribute"
                        },
                        "inputFormat": "MM/dd/yyyy HH:mm:ss a Z",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                }
            },
            "type": "dateMath"
        },
        "inputFormat": "yyyy-MM-dd'T'HH:mm",
        "outputFormat": "PEOPLE_SOFT"
    }
}

In this script, I have done the following:

  1. Format the FiredDate value to ISO8601 date format
  2. Apply "-1d" dateMath operation on the formatted date from #1
  3. Format output from #2 to PEOPLE_SOFT date format

Note: yyyy-MM-dd'T'HH:mm is always the output format of any dateMath operation.

Hope this helps.

Thanks @sjoyee . That worked.

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