The CreatorCon Call for Content is officially open! Get started here.

Illegal access to getter method getLocalDateTime in class com.glide.glideobject.GlideDateTime

SRI10
Tera Contributor

Hi All,

       I had worked on a requirement to automate the Time Sheets based on Users time off calendar event, with start and end date. In that duration the time sheets have to be automated. 

 I have written a Business rule which runs on insert of user calendar event with type time off. which is working fine.

One more Business rule, which runs on change of Start and End date according to that time sheets with the change dates will be recalled.

So It is working fine in dev instance and throwing error in test instance - error is "find_real_file.png" Can anyone help me why I'm getting this error? Please help me to fix this.

 

Thanks in advance...

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I could not find any function for getLocalDateTime()

Are you using correct function

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I didn't use that function, the start and end dates in user_calendar_event table is of scheduledGlideDateTime so to convert that to Glidedate i used the following function, which is working fine in Business rule used for Time Sheet Insert, on user_calendar_event insert with type- time off... how could this does'nt work in Business rule written to work on  date change, that too in a specific instance ? Could you please help me if i miss anything here?

In Business rule - 

var endDate1 = automation.convertScheduledGlideDateTimeToGlideDate(current.getValue('user'), previous.end_date_time);
var endDate2 = automation.convertScheduledGlideDateTimeToGlideDate(current.getValue('user'), current.end_date_time);

 

In Script include -

convertScheduledGlideDateTimeToGlideDate: function(user, date) {
var api = new SNC.ResourceManagementAPI();
var timeZone = api.getUserTimeZone(user);
var dateTimeInUserTimeZone = new GlideScheduleDateTime(date.getGlideObject());
dateTimeInUserTimeZone.setTimeZone(timeZone);
var iDate = dateTimeInUserTimeZone.getIntegerDate();
var convertDate = RMUtil.glideDateFromIntegerDate(iDate);
return convertDate;
}, 

i referred this conversion from Business Rule - Create allocation daily entries..