Transform null problem

Hi Team,

I have created one transform which is throwing error on attribute where I mapped, I understood that this is due to null problem , what if it is not getting the attribute value for termination date then it is returning error, Could you please help here how this can be handle, it should return N/A if there is no value present in termination date for the source. however this transform working fine for those having the termination date mapped from the source. would need your help to understand how we can solve this null error handling?

{
        "name": "Leaver-ServiceNowTicket",
        "type": "static",
        "attributes": {
            "ServiceNowLeaver": {
                "type": "dateCompare",
                "attributes": {
                    "firstDate": {
                        "type": "dateFormat",
                        "attributes": {
                            "input": {
                                "type": "dateMath",
                                "attributes": {
                                    "expression": "now"
                                }
                            },
                            "inputFormat": "yyyy-MM-dd'T'HH:mm",
                            "outputFormat": "ISO8601"
                        }
                    },
                    "secondDate": {
                        "type": "dateMath",
                        "attributes": {
                            "expression": "-2d",
                            "input": {
                                "type": "dateFormat",
                                "attributes": {
                                    "input": {
                                        "attributes": {
                                            "sourceName": "DEV",
                                            "attributeName": "Termination Date"
                                        },
                                        "type": "accountAttribute"
                                    },
                                    "inputFormat": "yyyy-MM-dd",
                                    "outputFormat": "ISO8601"
                                }
                            }
                        }
                    },
                    "operator": "gte",
                    "positiveCondition": "true",
                    "negativeCondition": "false"
                }
            },
            "value": "#if($ServiceNowLeaver == 'true')true#{else}false#end"
        },
        "internal": false
    }

Hi @LearningStar Wrap your Termination Date accountAttribute with a firstValid transform, with the second condition being a static date a long time in the future.

2 Likes

While response from @j_place provides the solution to the issue posted, I also wanted to add a point:
You can use

"expression": "now+2d"

in the firstDate calculation thus avoiding additional dateMath for the secondDate

Hi @LearningStar ,

Please use a firstValid transform for the termination date attribute and define a static date in case the termination date is not found. Also, set ignoreError to true.

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