Hello,
I’m trying to create a transform to handle the cloudLifecycleState attribute calculation.
It should be set to prehire when the identity in created. The date calculation are working as I tested the but the null check over the oldValue not and the oldValue is triggering an exception also if i just want to print it out.
This is the rule:
{
"name": "TWT - Calculate Lifecycle State",
"type": "static",
"attributes": {
"inPast": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "dateMath",
"attributes": {
"expression": "now"
}
},
"inputFormat": "yyyy-MM-dd'T'HH:mm",
"outputFormat": "ISO8601"
}
},
"secondDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "static",
"attributes": {
"value": "$identity.getStringAttribute('startDate').substring(0,10)"
}
},
"inputFormat": "YYYY-MM-dd",
"outputFormat": "ISO8601"
}
},
"operator": "gte",
"positiveCondition": "true",
"negativeCondition": "false"
}
},
"inLessThan10Day": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "static",
"attributes": {
"value": "$identity.getStringAttribute('startDate').substring(0,10)"
}
},
"inputFormat": "yyyy-MM-dd",
"outputFormat": "ISO8601"
}
},
"secondDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "dateMath",
"attributes": {
"expression": "now-10d"
}
},
"inputFormat": "yyyy-MM-dd'T'HH:mm",
"outputFormat": "ISO8601"
}
},
"operator": "gte",
"positiveCondition": "true",
"negativeCondition": "false"
}
},
"inFuture": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "static",
"attributes": {
"value": "$identity.getStringAttribute('startDate').substring(0,10)"
}
},
"inputFormat": "yyyy-MM-dd",
"outputFormat": "ISO8601"
}
},
"secondDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "dateMath",
"attributes": {
"expression": "now+10d"
}
},
"inputFormat": "yyyy-MM-dd'T'HH:mm",
"outputFormat": "ISO8601"
}
},
"operator": "gte",
"positiveCondition": "true",
"negativeCondition": "false"
}
},
"value": "#if( $oldValue == '' || $inFuture == 'true')prehire#elseif($oldValue == 'prehire' && $inLessThan10Day == 'true')joiner#elseif($oldValue == 'joiner' && $inPast == 'true')active#{else}$oldValue#end"
},
"internal": false
}
Can someone help me in checking for previous null value?
Thanks