Deluge function Time calculation and map with a field

Deluge function Time calculation and map with a field

Hi eveyrbody,

I wloud like some date fields in my module "PRODUITS_en_parc" to be automatically calculated from other fields in the same module and depending on NOW (or TODAY)

I can't do itt via formula and I read that moreover formula would not be automatically updated with Now() function (!!)

So for deluge code I tried this but It does not work. Can someone help me?

Should be something like this ?? Which arguments have to be mapped?
I put Fields name in BOLD.


mp = Map();

if(Date_Resil > Today)
{
Date_Fin = Date_terme_init;
}
else
{
nb_an_tacite = ceil(monthsdiff(Date_Resil,Today) / 12);
Date_Fin = addYear(Date_terme_init,nb_an_tacite);
}
mp.put("Date_Fin",Date_Fin);
update = zoho.crm.updateRecord("PRODUITS_en_parc",IDenreg,mp);


MANY Thanks in advance