Lifecycle state transform issue

Hey Guys,

i tried making a trasnform for the below requirements :

but havent got success after trying hard can some one please give me a trasnform on the condition that i gave you :

{
    "id": "39cac6cc-9ab9-480e-8011-aefc9f4a47e1",
    "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+21d/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": "0"
                        },
                        "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(($activeStatus == '1') && ($activestate == 'yes') && ($onleave == '0'))Active\n#elseif(($activeStatus == '0') && ($prehire == 'yes') && ($onleave != '1'))PreHire Disable\n#elseif($onleave == '1')LOA Disabled\n#elseif($terminationWithin35Days == 'yes')Terminated - Disabled\n#elseif($terminationBeyond35Days == 'yes')Terminated - Delete\n#{else}Keep current state#end"
    },
    "internal": false
}

First remove the new lines (\n) from

"value": "#if(($activeStatus == '1') && ($activestate == 'yes') && ($onleave == '0'))Active\n#elseif(($activeStatus == '0') && ($prehire == 'yes') && ($onleave != '1'))PreHire Disable\n#elseif($onleave == '1')LOA Disabled\n#elseif($terminationWithin35Days == 'yes')Terminated - Disabled\n#elseif($terminationBeyond35Days == 'yes')Terminated - Delete\n#{else}Keep current state#end"

So:

"value": "#if(($activeStatus == '1') && ($activestate == 'yes') && ($onleave == '0'))Active#elseif(($activeStatus == '0') && ($prehire == 'yes') && ($onleave != '1'))PreHire Disable#elseif($onleave == '1')LOA Disabled#elseif($terminationWithin35Days == 'yes')Terminated - Disabled#elseif($terminationBeyond35Days == 'yes')Terminated - Delete#{else}Keep current state#end"

Then I would check the lifecycle state names. You need to use the technicalName. “Terminated - Disabled” likely has a technicalName of “terminatedDisabled”. You can get the technicalName using the GET LifecycleStates API (https://developer.sailpoint.com/docs/api/v2024/get-lifecycle-states

The value statement also doesn’t have a not equal (!=) option, so you will need to change ($onleave != ‘1’). Do you even need to check to see if the Identity is Prehire and Onleave?

Also “Keep current state” isn’t an option. Transforms are point in time calculations. The transform has no knowledge of the Identity’s current lifecycle.

To simplify it, I would reverse the order:

"value": "#if($terminationBeyond35Days == 'yes')Terminated - Delete#elseif($terminationWithin35Days == 'yes')Terminated - Disabled#elseif($onleave == '1')LOA Disabled#elseif(($activeStatus == '0') && ($prehire == 'yes'))PreHire Disable#{else}Active"

Or the following if you want to have a LifecycleState for Identities that aren’t active, prehire, or terminated:

"value": "#if($terminationBeyond35Days == 'yes')Terminated - Delete#elseif($terminationWithin35Days == 'yes')Terminated - Disabled#elseif($onleave == '1')LOA Disabled#elseif(($activeStatus == '0') && ($prehire == 'yes'))PreHire Disable#elseif($activeStatus == '1') Active#{else}Inactive"

The Value statement will keep progressing until a statement has been met. So it would first check $terminationBeyond35Days, then $terminationWithin35Days, and so on.

1 Like

hey @Carlatto made one transform that is capable of calculating 3 life cycle state that is active prrehire disable and loa disabel but cant calculate two lcs term disable and term delete . can u pls check why is that because of the value order is wrong .? because i can see it can calculate all lcs when i tried reordering the value but still cant get all lcs accurately sometimes it is giving me same lifecycle state for my data for ex : when i gave the data for termination lcs it still gave active

{
    "id": "39cac6cc-9ab9-480e-8011-aefc9f4a47e1",
    "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+21d/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": "0"
                        },
                        "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(($activeStatus == '1') && ($activestate == 'yes') && ($onleave == '0'))Active#elseif(($activeStatus == '0') && ($prehire == 'yes') && ($onleave != '1'))PreHire Disable#elseif($onleave == '1')LOA Disabled#elseif($terminationWithin35Days == 'yes')Terminated - Disabled#elseif($terminationBeyond35Days == 'yes')Terminated - Delete#{else}Keep current state#end"
    },
    "internal": false
}

Hi Rakesh,

In ur scenario, If the identities do not have TERMINATION DATE, by default it wil take value as “9999-12-31T00:00:00Z”.

All the identities are having BLANK/NULL Values which is in attached picture.

While comparing current date and termination date , termination is always greater than current date if TERMINATION DATE is BLANK/Null.

Hope this is helpful. Thanks

I think you should change the “terminationWithin35Days”. Right now it is checking to see if now-35d/d is less than TerminationDate.

Now = 2025-03-03
Now-35d/d = 2025-01-28

The function would return ‘yes’ for any Termination Date that is 2025-01-28 or later (including your default value that Bhavithra mentioned). And it will return ‘no’ for any TermDate older than 2025-01-28.

If you change the first date to Now, and change the operator to GT, it will return ‘yes’ for any Identity that has a termination in the past.

Then make sure the Value statement looks at “terminationBeyond35Days” before it tries to look at “terminationWithin35Days”.

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