Transform LifeCycle State

Hi All,

I m using the below transform to calculate the Life Cycle state. The issue here i am facing is for leaving case i m not getting proper output. If the Contract_END_DATE is null also it shows as leaving. If the Contract_END_DATE is wihtin in next 14 days i need to mark the state as Leaving.

Any help s much appreciated !

{
    "id": "333a4ed5-1d52-49fb-abd9-aff607d28193",
    "name": "BLV_Workday_LCS",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "activestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "futureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "farFutureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+15d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "inactivestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            "now"
                        ],
                        "ignoreErrors": "true"
                    }
                },
                "operator": "GT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "leaving": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            "now"
                        ]
                    }
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "value": "#if(($activestate=='yes') && ($inactivestate=='no'))active#elseif($inactivestate=='yes')inactive#elseif(($futureContractor=='yes')&&($activestate=='no'))futureContractor#elseif(($futureContractor=='no')&&($activestate=='no'))farFutureContractor#elseif($leaving=='yes')leaving#{else}UNKNOWN#end"
    },
    "internal": false
}

Hello @sabthamis ,

I modified the transform you provided and it should work as expected now, give it a try in your environment!

{
    "id": "333a4ed5-1d52-49fb-abd9-aff607d28193",
    "name": "BLV_Workday_LCS",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "activestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "futureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "farFutureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+15d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "LT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "inactivestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            "now"
                        ],
                        "ignoreErrors": "true"
                    }
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "leaving": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            "now"
                        ]
                    }
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')inactive#elseif($leaving=='yes')leaving#elseif(($activestate=='yes') && ($inactivestate=='no'))active#elseif(($futureContractor=='yes')&&($activestate=='no'))futureContractor#elseif(($futureContractor=='no')&&($activestate=='no'))farFutureContractor#{else}UNKNOWN#end"
    },
    "internal": false
}

Thanks for your response !

I can see still not working the User with only HIREDATE and CONTRACT_END_DATE as null or blank also it shows as leaving @tyler_mairose

@sabthamis ,

When the user has HIREDATE and CONTRACT_END_DATE as null or blank, what is your expected lifecycle state?

Hi Tyler,

There is not case where both can be null HIREDATE is not null for any user from Workday. so i dont have any case like you mentioned.

Thanks

@tyler_mairose

I misunderstood, in the case of only CONTRACT_END_DATE null or empty what should be the lifecycle state?

Hi Tyler, @tyler_mairose -

In the case when user have only HIREDATE and if the CONTRACT_END_DATE is null i m getting the Lifecycle state as leaving. The case 1 is not working rest all 4 is working with the transform.

The requirement here to display the below conditions.

1.If the CONTRACT_END_DATE is within next 14 days considering the HIREDATE can be anyvalue (not Null)– Leaving

2.If the CONTRACT_END_DATE is in past considering the HIREDATE can be anyvalue (not Null)- Inactive

3.If the HIREDATE is within next 14 days considering the CONTRACT_END_DATE can be anyvalue (can be null or not null) - FutureContractor

4.If the HIREDATE is within next 14 days considering the CONTRACT_END_DATE can be anyvalue (can be null or not null) - FarFutureContractor

5.If the HIREDATE is in past the CONTRACT_END_DATE can be anyvalue (can be null or not null) - Active

Regards,
Sabthami

@sabthamis

Thank you for the clarification, I had to modify the leaving variable to get it working. See below!

{
    "name": "BLV_Workday_LCS",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "activestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "futureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "GTE",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "farFutureContractor": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+15d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "HIREDATE",
                                "sourceName": "Workday"
                            }
                        },
                        "inputFormat": "MM/dd/yyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "LT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "inactivestate": {
            "attributes": {
                "firstDate": "now",
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            "now"
                        ],
                        "ignoreErrors": "true"
                    }
                },
                "operator": "GT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "leaving": {
            "attributes": {
                "firstDate": {
                    "attributes": {
                        "expression": "now+14d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "attributes": {
                                    "input": {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "attributeName": "CONTRACT_END_DATE",
                                            "sourceName": "Workday"
                                        }
                                    },
                                    "inputFormat": "MM/dd/yyyy",
                                    "outputFormat": "ISO8601"
                                },
                                "type": "dateFormat"
                            },
                            {
                                "attributes": {
                                    "expression": "now+14d/d",
                                    "roundUp": false
                                },
                                "type": "dateMath"
                            }
                        ]
                    }
                },
                "operator": "GT",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            },
            "type": "dateCompare"
        },
        "value": "#if($inactivestate=='yes')inactive#elseif($leaving=='yes')leaving#elseif(($activestate=='yes') && ($inactivestate=='no'))active#elseif(($futureContractor=='yes')&&($activestate=='no'))futureContractor#elseif(($futureContractor=='no')&&($activestate=='no'))farFutureContractor#{else}UNKNOWN#end"
    },
    "internal": false
}

Thanks for your help @tyler_mairose much appreciated …

@sabthamis Did Tyler’s solution solve your problem?

Yes thanks Colin much for your help