Cases Auto Closure

I wanted to set "Auto closure" for all the cases that meet the below Criteria/Rule available under Data menu option :

  1. If the User name is equal to "demo3"
  2. And if the date value of case property ("hvdir_date_reporting") is older than 260 days

So, i created a rule as follows ((Data -> Edit Data -> Automatically Update Cases) :

But, The cases are not getting closed, where few of the cases have got value even more than 260 days.

I also would like to share that, the case property (hvdir_date_reporting) is saving the date with below format
format-date(today(), "%d/%m/%Y")

I am not sure, how to sort out this issue.

So, please suggest.

Thanks and regards,

Hi Sahu,

It's almost certainly the case that the system isn't able to infer the date from that saved format.

I'm not actually 100% clear on exactly what saved date formats are compatible with auto case close rules, but the safest assumption would be to make sure the dates are ISO8601 formatted. This is the default string output format when using the date() function, so wrapping whatever you are hoping to use with that function (or potentially using the output of today() directly) is probably the best plan.

Clayton is correct, the date must be formatted as "%Y-%m-%d". It may optionally include a time component.

Thanks, Clayton and Simon !

So in this case, if we refer system generate case properties ("opened_on") in place of dynamic case properties ("hvdir_date_reporting"), then possibly it can fulfill the above requirement.

So, I will check and update on this.

Both of the case properties are storing the same date, while Dynamic Case properties ("hvdir_date_reporting") with format-date.

Thanks and regards,
Gurudayal Sahu

Dear Clayton and Simon,

I am still having the same issue even after referring the system date ("opened_on"). I was expecting to get the below highlight cases closed


through the below rule criteria defined in "Automatically Update Cases"

I am not sure, where i am missing or making the mistake, so please suggest me.

Thanks and regards,

Hi Gurudayal Sahu

The only think I can see from your post that is incorrect is that opened_by stores the user ID, not the username. You can get the ID for the user by going to the 'edit user' page and copying the ID from the URL:[DOMAIN]/settings/users/commcare/account/[USER_ID]/

It will be a string of letters and numbers, something like 6d39fac26f574afb81d0a8a0e916eb88

Hi Simon,

Sorry for the delay in my response.

Thanks for investigating further on this, I located the user_id and replaced the user user name with its user_id . Hope it should work now.
I will also update on this by tomorrow after its schedule run.

Thanks and regards,
Gurudayal Sahu

Hi Simon,
It worked perfectly fine.

Thanks once again for the support on this.

With regards,
Gurudayal Sahu

1 Like