Help in Transform

Dear all, I need support in transform, where I validate the date received by the leave_end_date field, and I need it to return in the field if the condition is “active” or “vacation” in the first minute of the future day, that is, example: if leave_end_date is equal to “2025-02-10” I need you to consult and activate it only if the date is “2025-02-11”

follow the transform

 {
        "name": "PP_Employee_status_V1",
        "type": "lookup",
        "attributes": {
            "input": {
                "type": "static",
                "attributes": {
                     "dataFimAfastamento": {
                        "attributes": {
                            "values": [
                                {
                                    "attributes": {
                                        "firstDate": {
                                            "attributes": {
                                                "expression": "+1d",
                                                "input": {
                                                    "attributes": {
                                                        "input": {
                                                            "attributes": {
                                                                "attributeName": "leave_end_date",
                                                                "sourceName": "ms-witchcraft-absences - PROD"
                                                            },
                                                            "type": "accountAttribute"
                                                        },
                                                        "inputFormat": "yyyy-MM-dd",
                                                        "outputFormat": "ISO8601"
                                                    },
                                                    "type": "dateFormat"
                                                }
                                            },
                                            "type": "dateMath"
                                        },
                                        "secondDate": "now",
                                        "operator": "gt",
                                        "positiveCondition": "ativo",
                                        "negativeCondition": "ferias"
                                    },
                                    "type": "dateCompare"
                                },
                                "null"
                            ]
                        },
                        "type": "firstValid"
                    },
                    "status": {
                        "attributes": {
                            "values": [
                                {
                                    "attributes": {
                                        "attributeName": "employee_status",
                                        "sourceName": "ms-witchcraft-absences - PROD"
                                    },
                                    "type": "accountAttribute"
                                },
                                "null"
                            ]
                        },
                        "type": "firstValid"
                    },
                   
                    "value": "#if($status == 'ATIVO' && $dataFimAfastamento == 'ativo')1#elseif($status == 'Férias' && $dataFimAfastamento == 'ativo')1#elseif($status == 'Férias' && $dataFimAfastamento == 'ferias')2#{else}1#end"
                }
            },
            "table": {
                "1": "ativo",
                "2": "ferias",
                "default": "outros"
            }
        },
        "internal": false
    }

I think you got the logic in dateCompare reversed.
You are returning “ativo” when (leave_end_date + 1d) gt now which means if the leave_end_date is in future. try using lte instead of gt

Thanks, for now, it seems to work, my head was exploding, with the logic confusing me lol.

Another question, how do I know what time Sailpoint now is?
Since I need this update to be carried out in the first minute of the day.

now is always the current UTC time to the last second (or milli second)

Hi Nithesh Rao, how are you?
Can you help me?
What I need to do is compare the two dates with now, leave_start_date, now, leave_end_date

{
    "name": "PP_Employee_status_v10",
    "type": "lookup",
    "attributes": {
        "input": {
            "type": "static",
            "attributes": {
                "inicioAfastamento": {
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "firstDate": {
                                        "attributes": {
                                            "input": {
                                                "attributes": {
                                                    "input": {
                                                        "attributes": {
                                                            "attributeName": "leave_start_date",
                                                            "sourceName": "ms-witchcraft-absences - PROD"
                                                        },
                                                        "type": "accountAttribute"
                                                    },
                                                    "inputFormat": "yyyy-MM-dd",
                                                    "outputFormat": "ISO8601"
                                                },
                                                "type": "dateFormat"
                                            }
                                        },
                                        "type": "dateMath"
                                    },
                                    "secondDate": {
                                           "attributes": {
                                                "input": {
                                                    "attributes": {
                                                        "expression": "now",
                                                        "roundUp": false
                                                    },
                                                    "type": "dateMath"
                                                },
                                                "inputFormat": "yyyy-MM-dd'T'HH:mm",
                                                "outputFormat": "ISO8601"
                                            },
                                            "type": "dateFormat"
                                    },
                                    "operator": "lte",
                                    "positiveCondition": "ativo", 
                                    "negativeCondition": "afastado"
                                },
                                "type": "dateCompare"
                            },
                            "null"
                        ]
                    },
                    "type": "firstValid",
                    "requiresPeriodicRefresh": "true"
                },
                "fimAfastamento": {
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "firstDate": {
                                        "attributes": {
                                            "input": {
                                                "attributes": {
                                                    "input": {
                                                        "attributes": {
                                                            "attributeName": "leave_end_date",
                                                            "sourceName": "ms-witchcraft-absences - PROD"
                                                        },
                                                        "type": "accountAttribute"
                                                    },
                                                    "inputFormat": "yyyy-MM-dd",
                                                    "outputFormat": "ISO8601"
                                                },
                                                "type": "dateFormat"
                                            }
                                        },
                                        "type": "dateMath"
                                    },
                                    "secondDate": {
                                           "attributes": {
                                                "input": {
                                                    "attributes": {
                                                        "expression": "now",
                                                        "roundUp": false
                                                    },
                                                    "type": "dateMath"
                                                },
                                                "inputFormat": "yyyy-MM-dd'T'HH:mm",
                                                "outputFormat": "ISO8601"
                                            },
                                            "type": "dateFormat"
                                    },
                                    "operator": "gte",
                                    "positiveCondition": "ferias",
                                    "negativeCondition": "ativo"
                                },
                                "type": "dateCompare"
                            },
                            "null"
                        ]
                    },
                    "type": "firstValid",
                    "requiresPeriodicRefresh": "true"
                },
                "StatusAfastamento": {
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "attributeName": "employee_employee_status",
                                    "sourceName": "ms-witchcraft-absences - PROD"
                                },
                                "type": "accountAttribute",
                                "requiresPeriodicRefresh": "true"
                            },
                            "null"
                        ]
                    },
                    "type": "firstValid",
                    "requiresPeriodicRefresh": "true"
                },
                 "value": "#if($inicioAfastamento == 'ferias' && $fimAfastamento == 'ferias')2#elseif($inicioAfastamento == 'ativo' && $fimAfastamento == 'ferias')2#elseif($inicioAfastamento == 'ferias' && $fimAfastamento =='ativo')2#elseif($StatusAfastamento != 'ATIVO' && $StatusAfastamento != 'Demissão' && $StatusAfastamento != 'null' && $StatusAfastamento != 'Férias')2#{else}1#end"

            }
        },
        "table": {
            "1": "ativo",
            "2": "afastado",
            "default": "outros"
        }
    },
    "internal": false
}

Example
Rex has:
leave_start_date
2025-03-05
leave_end_date
2025-03-14
employee_status
Férias

However, I need to focus only on the dates, because I want to be proactive and release the lifecycle before the employee_status is updated.

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