Dathmath Transform - How to Handle Null Input

Hi all!

Need some help please! We’re trying to read last sign in timestamps from Entra but they come in UTC, so I’m applying a datemath to convert to local (AEST +11hr), looks like this:

    {
        "name": "Adjust UTC to Local time",
        "type": "dateMath",
        "attributes": {
            "expression": "+11h/d",
            "roundUp": false
        },
        "internal": false
    },

There are plenty of accounts that have never logged in and don’t have a timestamp, and are thus null which means identity processing fails because of this exception:

“There was an exception while calculating the value for this attribute. Error during transformation for attribute: lastNoninteractiveSignin (Transform ID: Datemath Test) Cause: DateMathTransform requires an input date or date expression with ‘now’“

How can I best solve this problem?

Cheers,

Sean

You can wrap up your logic inside firstValid transform to resolve this. Here is the sample and remember to pass ignoreError as true to allow firstValid to go to next condition

{
  "name": "LastSignIn",
  "type": "firstValid",
  "attributes": {
    "ignoreErrors": "true",
    "values": [
      {
        "type": "dateFormat",
        "attributes": {
          /*** your logic here***/
        }
      },
      { "type": "static", "attributes": { "value": "" } }
    ]
  }
}

This worked a charm!

Perfect, thank you very much @udayputta :slight_smile:

1 Like

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