Hi @Ankur Bawiskar 

Your code is showing the error message as below. I have a code that is not showing any error but is passing wrong value.

i have tried a lot but  not found the solution. thats why I come for help. Please provide tested code from your end if possible. Also I am attaching my code here.

Your code error :
Script execution error: Script Identifier: null.null.script, Error Description: Can't find method com.glide.glideobject.GlideDateTime.setTZ(java.lang.String). (null.null.script; line 21), Script ES Level: 0
Javascript compiler exception: Can't find method com.glide.glideobject.GlideDateTime.setTZ(java.lang.String). (null.null.script; line 21) in: (function() { // Input: User sys_id var userSysId = '15084293872829101ce5fc48dabb3502'; // Replace with actual user sys_id // Get user record var userGR = new GlideRecord('sys_user'); if (!userGR.get(userSysId)) { gs.error('User not found'); return; } // Get user's time zone var userTimeZone = userGR.time_zone; if (!userTimeZone) { gs.error('User time zone not set'); return; } // Get current time in ...
Could not find field delete_recovery in table sys_audit_delete during cascade delete


My script :


var approverId = '5137153cc611227c000bbd1bd8cd2007';
 
var user = new GlideRecord('sys_user');
if (!user.get(approverId)) {
gs.info('User not found.');
} else {
    var tz = user.time_zone || 'UTC'; 
gs.info('User time zone: ' + tz);
 
  
    var nowUTC = new GlideDateTime();
gs.info('Current time in UTC: ' + nowUTC.getDisplayValue());
 
    var currentDate = new Date();
    var options = { timeZone: tz, hour: '2-digit', minute: '2-digit', second: '2-digit' };
    var formattedTime = currentDate.toLocaleString('en-US', options); // Adjust for the user's time zone
 
gs.info('Current time in user\'s time zone: ' + formattedTime);
 
    
    var hour = parseInt(formattedTime.split(':')[0]); 
    var day = currentDate.getDay(); 
 
    var inWorkingHours = (hour >= 9 && hour < 17);
    var inWorkingDays = (day >= 1 && day <= 5); 
 
gs.info('In working hours: ' + inWorkingHours + ' and on working day: ' + inWorkingDays);
 
    if (!user.schedule) {
gs.info('No schedule found, using fallback hours.');
    } else {
        var scheduleId = user.schedule;
        var sched = new GlideSchedule(scheduleId);
        var nextScheduleTime = sched.getNextScheduleDateTime(nowUTC);
gs.info('Next available working time (UTC): ' + nextScheduleTime.getDisplayValue());
    }
}