Transformation for setup lifecycle state

We have onboarded a new source for contractors called LDAP. We need to set up lifecycle states based on three attributes start date, exit date, and Isexpired date. The condition is that when the exit date is valid and greater than the expiration date, then the lifecycle state should be set to “Is expired.” We have already developed two states: isPreHire and isTerminated. Can you please help me with setting up the Is Expired state?

"name": "Calculate Lifecycle State - Sandbox",

    "type": "static",

    "attributes": {

        "requiresPeriodicRefresh": "true",

        "isPreHire": {

            "attributes": {

                "negativeCondition": "no",

                "positiveCondition": "yes",

                "firstDate": "now",

                "operator": "lt",

                "secondDate": {

                    "attributes": {

                        "inputFormat": "yyyy-MM-dd",

                        "outputFormat": "ISO8601",

                        "input": {

                            "attributes": {

                                "attributeName": "startDate",

                                "sourceName": "LDAP 2"

                            },

                            "type": "accountAttribute"

                        }

                    },

                    "type": "dateFormat"

                }

            },

            "type": "dateCompare"

        },

        "isTerminated": {

            "type": "firstValid",

            "attributes": {

                "values": [

                    {

                        "type": "dateCompare",

                        "attributes": {

                            "negativeCondition": "no",

                            "positiveCondition": "yes",

                            "firstDate": "now",

                            "operator": "gt",

                            "secondDate": {

                                "attributes": {

                                    "inputFormat": "yyyy-MM-dd",

                                    "outputFormat": "ISO8601",

                                    "input": {

                                        "attributes": {

                                            "attributeName": "exitDate",

                                            "sourceName": "LDAP 2"

                                        },

                                        "type": "accountAttribute"

                                    }

                                },

                                "type": "dateFormat"

                            }

                        }

                    },

                    {

                        "type": "static",

                        "attributes": {

                            "value": "{null}"

                        }

                    }

                ]

            }

        },
 "value": "#if($isPreHire=='yes')preActive#elseif($isTerminated != '{null}' && $isTerminated=='yes')inactive#elseif($isPreHire=='no')active{else}unknown#end"

    },

    "internal": false

Hi @Polarao

Welcome to SailPoint developer community.

You can add the below snippet in your static transform along with the existing one then adjust your value script.I have assumed that the expiration date source is same only, you may change it according to your need.

Let me know if you further need support.

{
    "attributes": {
        "firstDate": {
            "attributes": {
                "inputFormat": "yyyy-MM-dd",
                "outputFormat": "ISO8601",
                "input": {
                    "attributes": {
                        "attributeName": "expirationDate",
                        "sourceName": "LDAP 2"
                    },
                    "type": "accountAttribute"
                }
            },
            "type": "dateFormat"
        },
        "secondDate": {
            "attributes": {
                "inputFormat": "yyyy-MM-dd",
                "outputFormat": "ISO8601",
                "input": {
                    "attributes": {
                        "attributeName": "exitDate",
                        "sourceName": "LDAP 2"
                    },
                    "type": "accountAttribute"
                }
            },
            "type": "dateFormat"
        },
        "operator": "gt",
        "positiveCondition": "IS_Expired",
        "negativeCondition": "Not Expired"
    },
    "type": "dateCompare",
    "name": "Date Compare Transform"
}
3 Likes

Thank you. My requirement is that the end date is valid and greater than the expiry date, then it needs to check again if the expiry date is valid compared to the current date. If it is valid, then it should display “Isexpired”.

Hi @Polarao,

Please take a look on the below logic, it utilizes dateCompare and combines your static transform.
This you can use as one of the inputs in your static transform. You may adjust the values as per need.

{
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "firstValidation": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "inputFormat": "yyyy-MM-dd",
                        "outputFormat": "ISO8601",
                        "input": {
                            "attributes": {
                                "attributeName": "expirationDate",
                                "sourceName": "LDAP 2"
                            },
                            "type": "accountAttribute"
                        }
                    },
                    "type": "dateFormat"
                },
                "secondDate": {
                    "attributes": {
                        "inputFormat": "yyyy-MM-dd",
                        "outputFormat": "ISO8601",
                        "input": {
                            "attributes": {
                                "attributeName": "exitDate",
                                "sourceName": "LDAP 2"
                            },
                            "type": "accountAttribute"
                        }
                    },
                    "type": "dateFormat"
                },
                "operator": "gt",
                "positiveCondition": "Valid",
                "negativeCondition": "InValid"
            },
            "type": "dateCompare"
        },
        "secondValidation": {
            "type": "dateCompare",
            "attributes": {
                "negativeCondition": "InValid",
                "positiveCondition": "Valid",
                "firstDate": "now",
                "operator": "gt",
                "secondDate": {
                    "attributes": {
                        "inputFormat": "yyyy-MM-dd",
                        "outputFormat": "ISO8601",
                        "input": {
                            "attributes": {
                                "attributeName": "expirationDate",
                                "sourceName": "LDAP 2"
                            },
                            "type": "accountAttribute"
                        }
                    },
                    "type": "dateFormat"
                }
            }
        }
    },
    "value": "#if($firstValidation=='Valid' && secondValidation=='Valid')IsExpired{else}unknown#end"
}
2 Likes

Hi Ashutosh,
Thanks for your support. The earlier transfer you provided is working perfectly as expected.

1 Like

Hi @polaraojalligampala,

Feel free to mark the response as solution if it resolved your query.

Thanks

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