Lifecyclestate transform using vtl

It looks like the root of your problem is how you are comparing the dates. You convert them to “ddMMyyyy”, then run a compareTo method on the string representations of the dates. The problem is that compareTo compares strings lexicographically, not numerically. This means that trying to compare two strings that are >= 30 will never work because comparing strings doesn’t produce a result like that. Dates are complicated, and simple integer or string comparison won’t tell you the number of days between two dates. That will require a more complex function.

public class Main {
  public static void main(String[] args) {
    String now = "14022023"; // February 14, 2023
    String end = "01112023"; // November 1, 2023
    System.out.println(now.compareTo(end)); // returns 1
  }
}
public class Main {
  public static void main(String[] args) {
    String now = "14022023"; // February 14, 2023
    String end = "11112023"; // November 11, 2023
    System.out.println(now.compareTo(end)); // returns 3
  }
}

You might be able to solve this use case by using date math and date compare operations. Check this post to see how you can project a date 30 days into the future and then run a comparison to see if it is simply greater or less than the current date.