Hi, good afternoon.
I need help with a new custom function.
d = zoho.currenttime.tostring("yyyy-MM-dd","GMT-8:0");
c = d.getDayOfWeek().toLong();
cd = {4,3,2,1,7,5,6};
add = {9,10,11,12,6,8,7};
ind = cd.indexOf(c);
val = add.get(ind);
nextFriday = d.addDay(val);
mp = Map();
mp.put("Commission_1_date",nextFriday);
info "Map : " + mp;
upd = zoho.crm.updateRecord("Deals",dealID,mp);
info upd;
What this function does is set my custom field called "Commission_1_date" to "the next week Friday". I trigger this function via workflow using another custom date field, called "installation date", so basically how it works is like this:
If "installation date" = Wednesday December 1 2021 then "Commission_1_date" = Friday December 10 2021 or
If "installation date" = Saturday December 4 2021 then "Commission_1_date" = Friday December 10 2021 or
If "installation date" = Friday December 10 2021 then "Commission_1_date" = Friday December 17 2021 or
If "installation date" = Monday December 20 2021 then "Commission_1_date" = Friday December 24 2021 and so on....
Now what I need to do now is modify this custom function to do this:
If "installation date" = Wednesday December 1 2021 then "Commission_1_date" = Friday December 17 2021 or
If "installation date" = Saturday December 4 2021 then "Commission_1_date" = Friday December 17 2021 or
If "installation date" = Friday December 10 2021 then "Commission_1_date" = Friday December 24 2021 or
If "installation date" = Monday December 20 2021 then "Commission_1_date" = Friday January 7 2022 and so on....
Thanks for the help.