Lifecyclestate transform using vtl

sure!, please see the below code:

{
    "name": "lcs",
    "type":"static",
    "attributes": {
        "inPast": {
            "type": "dateCompare",
            "attributes": {
                "firstDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type":"dateMath",
                            "attributes": {
                                "expression": "now"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    }
                },
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "<>",
                                "attributeName": "<>"
                            }
                        },
                        "inputFormat": "ddMMyyyy",
                        "outputFormat": "ISO8601"
                    }
                },
                "operator": "lt",
                "positiveCondition": "true",
                "negativeCondition": "false"
            }
        },
       
	    "start": {
            "type": "dateCompare",
            "attributes": {
                "firstDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type":"dateMath",
                            "attributes": {
                                "expression": "now"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    }
                },
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "<>",
                                "attributeName": "<>"
                            }
                        },
                        "inputFormat": "ddMMyyyy",
                        "outputFormat": "ISO8601"
                    }
                },
                "operator": "gte",
                "positiveCondition": "true",
                "negativeCondition": "false"
            }
        },
	   
	   "end_date": {
            "type": "dateCompare",
            "attributes": {
                "firstDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type":"dateMath",
                            "attributes": {
                                "expression": "now"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    }
                },
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "<>",
                                "attributeName": "<>"
                            }
                        },
                        "inputFormat": "ddMMyyyy",
                        "outputFormat": "ISO8601"
                    }
                },
                "operator": "lte",
                "positiveCondition": "true",
                "negativeCondition": "false"
            }
        },

       
	   
	   
	   
	   
	  "thirtycheck": 
       { 
	   
	   "type": "dateCompare",
            "attributes": 
			{
                "firstDate": 
				{
                    "attributes": 
					{
                        "expression": "now-30d/d",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "secondDate": {
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "attributeName": "<>",
                                "sourceName": "<>"
                            }
                        },
                        "inputFormat": "ddMMyyyy",
                        "outputFormat": "ISO8601"
                    },
                    "type": "dateFormat"
                },
                "operator": "gt",
                "positiveCondition": "yes",
                "negativeCondition": "no"
            }
           
         },
	   

		"d_check": {
            "type": "dateCompare",
            "attributes": {
                "firstDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type":"dateMath",
                            "attributes": {
                                "expression": "now"
                            }
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "ISO8601"
                    }
                },
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "input": {
                            "type": "accountAttribute",
                            "attributes": {
                                "sourceName": "<>",
                                "attributeName": "<>"
                            }
                        },
                        "inputFormat": "ddMMyyyy",
                        "outputFormat": "ISO8601"
                    }
                },
                "operator": "gt",
                "positiveCondition": "true",
                "negativeCondition": "false"
            }
        },
		
        "value": "#if($inPast=='true')ABCD#elseif($start=='true' && $end_date=='true')XYZ#elseif($thirtycheck=='yes')PQRS#elseif($d_check=='true')anything#{else}#end"
    }
}
1 Like