Hey guys i am facing issue in lifecycle trasnform value block please let me know whats wrong unable to debug from long thanks
That’s a long and somewhat complicated template; it would be hard to troubleshoot without seeing the transform. Can you share the transform?
remove "
around the string values
ie instead of "terminatedDisabled"
use terminatedDisabled
also for the #else
use #{else}
{
"id": "83d8ed41-7474-41a5-965c-60730adf8398",
"name": "DUMMY-WORKDAY_LifecycleState_Transform",
"type": "static",
"attributes": {
"requiresPeriodicRefresh": "true",
"activeStatus": {
"attributes": {
"values": [
{
"attributes": {
"attributeName": "ACTIVE_STATUS",
"sourceName": "DUMMY-WORKDAY"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "0"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"prehire": {
"attributes": {
"firstDate": {
"attributes": {
"expression": "now+30d/d",
"roundUp": false
},
"type": "dateMath"
},
"secondDate": {
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"attributeName": "HIREDATE",
"sourceName": "DUMMY-WORKDAY"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"operator": "GTE",
"positiveCondition": "yes",
"negativeCondition": "no"
},
"type": "dateCompare"
},
"activestate": {
"attributes": {
"firstDate": {
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"attributeName": "HIREDATE",
"sourceName": "DUMMY-WORKDAY"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"secondDate": "now",
"operator": "LTE",
"positiveCondition": "yes",
"negativeCondition": "no"
},
"type": "dateCompare"
},
"onleave": {
"attributes": {
"values": [
{
"attributes": {
"attributeName": "ON_LEAVE",
"sourceName": "DUMMY-WORKDAY"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": ""
},
"type": "static"
}
]
},
"type": "firstValid"
},
"ltdsep": {
"attributes": {
"values": [
{
"attributes": {
"attributeName": "LTD_SEP",
"sourceName": "DUMMY-WORKDAY"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": ""
},
"type": "static"
}
]
},
"type": "firstValid"
},
"terminated": {
"attributes": {
"values": [
{
"attributes": {
"attributeName": "TERMINATED",
"sourceName": "DUMMY-WORKDAY"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": ""
},
"type": "static"
}
]
},
"type": "firstValid"
},
"terminationState": {
"attributes": {
"values": [
{
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"attributeName": "TERMINATION_DATE",
"sourceName": "DUMMY-WORKDAY"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
{
"attributes": {
"value": "9999-12-31T00:00:00Z"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"terminationWithin35Days": {
"attributes": {
"firstDate": {
"attributes": {
"expression": "now-35d/d"
},
"type": "dateMath"
},
"secondDate": {
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"attributeName": "TERMINATION_DATE",
"sourceName": "DUMMY-WORKDAY"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
{
"attributes": {
"value": "9999-12-31T00:00:00Z"
},
"type": "static"
}
]
}
},
"operator": "LT",
"positiveCondition": "yes",
"negativeCondition": "no"
},
"type": "dateCompare"
},
"terminationBeyond35Days": {
"attributes": {
"firstDate": {
"attributes": {
"expression": "now-35d/d"
},
"type": "dateMath"
},
"secondDate": {
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"attributeName": "TERMINATION_DATE",
"sourceName": "DUMMY-WORKDAY"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
{
"attributes": {
"value": "9999-12-31T00:00:00Z"
},
"type": "static"
}
]
}
},
"operator": "GTE",
"positiveCondition": "yes",
"negativeCondition": "no"
},
"type": "dateCompare"
},
"value": "#if(($terminationWithin35Days == 'yes') && ($terminated == '1') && ($terminationState != '9999-12-31T00:00:00Z') && ($activeStatus == '0'))terminatedDisabled#elseif(($terminationBeyond35Days == 'yes') && ($terminated == '1') && ($terminationState != '9999-12-31T00:00:00Z') && ($activeStatus == '0'))terminatedDelete#elseif(($onleave == 'Y') && ($ltdsep == 'Y'))loaDisabled#elseif(($activeStatus == '0') && ($prehire == 'yes') && ($terminated == '0') && ($onleave != 'Y'))prehireDisable#elseif(($activeStatus == '1') && ($terminated == '0') && ($activestate == 'yes') && ($ltdsep == '') && ($onleave == ''))active#{else}Keep current state#end"
},
"internal": false
}```
@iamology pls review i have attached full trsnform
One issue is for the terminated variable, you’re using a first valid and the first option is coming from the HR source (which is where I’m assuming the ‘1’ option is coming from) but the 2nd option is “”, and if it calculates to that, that might throw an error since it is null/empty. You might want to just use some dummy string like “null”
Similarly, the onleave and ltdsep variables have null options.
@vkashat no basically we have to make a null check since its the need let me share the requiremtn test case we have to make the trasnform for
TEST CASE | TERMINATED | TERMINATION_DATE | ACTIVE_STATUS | HIREDATE | ON_LEAVE | LTD_SEP | Expected LCS |
---|---|---|---|---|---|---|---|
1 | 1 | 3/1/2025 | 0 | 1/1/2022 | Terminated - Disabled (Termination Date < 35 days from today) | ||
2 | 1 | 2/1/2025 | 0 | 1/1/2022 | Terminated - Delete (Termination Date > 35 days from today) | ||
3 | 0 | 1 | 4/1/2023 | Y | Y | LOA Disabled (ON_LEAVE + LTD_SEP = Y) | |
4 | 0 | 0 | 5/10/2025 | PreHire Disable (Start Date < 30 days from today) | |||
5 | 0 | 1 | 4/1/2024 | Active (Start Date ≤ today) | |||
6 | 0 | 1 | 5/10/2025 | Y | Keep current state |
Yeah but the velocity template may not render if there are null variables, so you have to use dummy text like “null” or “none” or something like that instead of “”
@vkashat is right
wherever you have ""
as second option in firstValid transforms, replace them with a string like "NONE"
and, why do you have terminationState
in ISO8601 format? I don’t see a reason to do this