ACL - current ?

Andrii
Kilo Guru

I'm writing ACLs for TimeCards and here is the issue I faced: within ACL Script I want to log:

gs.log('**** TimeCard.Sunday.acl.week_starts_on = '+current.week_starts_on);

However value of current.week_starts_on is always different and unpredictable. Sometimes I can get date that is one or two weeks ahead.

Only last hour it got to normal work returning the real value of week_starts_on.

**** TimeCard.Sunday.acl.week_starts_on = 2016-10-16

find_real_file.png

Any ideas of possible root-cause?

P.S. Additionaly I was calling Script Include from ACL Script field and passing current object to Script Include.

Script Include also logged unpredictable values.

6 REPLIES 6

Kalaiarasan Pus
Giga Sage

This is present in the dictionary default value for the field



javascript:var today = new GlideDateTime(); var dtUtil = new DateTimeUtils(); var firstDay = gs.getProperty("com.snc.time_card.start_day", 7); var start = dtUtil.getWeekStart(today, firstDay); start.getDisplayValue();



So if the field is empty, that would be the reason why.


No, field is not empty. I am sure. This is not about field emptiness - this is about some other conflig of logic.


Just look what values it gets from the same Time Card:



find_real_file.png



Notice that Saturday = 2016.11.05 and Friday in the same TimeCard somewhy equals 2016.10.30 (Week Starts On = 2016-10-16)



So far I have 7 ACLs for each day. Code example follows:



var moDay = current.week_starts_on.getGlideObject();


moDay.addDays(1); // Depends on ACL for each day integer is different (Su=0,Mo=1,Tu=2,We=3,Th=4,Fr=5,Sa=6)



gs.log('TimeCard.Monday = '+moDay);


...



Am I doing something wrong that SN calculates this way?


Just to demonstrate that I'm talking aboutfields from the same TimeCard - see sys_id of TimeCard:



find_real_file.png