An incorrect schedule is attached to the case in the "Show SLA Timeline" section.

Govinda Varma
Tera Contributor

An incorrect schedule is attached to the case in the "Show SLA Timeline" section.

For instance, I am an Opened user from Italy in the HR case management system. If we create a case, it should be tied to the Task SLA under associated links in the HR case form under the "Italy - Business day excluding defined Holidays + weekend" schedule.

 

In the meantime, when we click on the "Show SLA Timeline" UI Action in the case form, the wrong schedule—"8-5 weekdays excluding holidays"—is displayed. Thus, we would want to view the accurate schedule here. "Italy - Business day excluding defined Holidays + weekend"

 

Please assist us in finding a quick solution to this problem. Thank you

 

Regards, 

Govinda Varma T.

2 REPLIES 2

Community Alums
Not applicable

Hi @Govinda Varma  ,

Can you share your SLA configurations here please.

 

Govinda Varma
Tera Contributor

Hi @Sandeep 

Thanks for the quick response.

As of right now, I am a user from the "Republic of Korea," so if I establish a case, In the task SLA the following schedule bas been attached, "Republic of Korea - Business day excluding holidays + weekend." This is because we are creating an HR case based on the user's work country.

We are generating the schedule in the Task SLA based on the Opened For user work country. To do this, we have built a Custom Business Rule. Please check the script provided below.

(function executeRule(current, previous /*null when async*/ ) {

    // Update the schedule of the SLA based on user work country

    var usercountry = '';
    var grUser = new GlideRecord('sn_hr_core_case'); //look up HR case related to this Task SLA
    grUser.addQuery('sys_id', current.task);
    grUser.query();

    if (grUser.next()) {
        var grHRUser = new GlideRecord('sn_hr_core_profile'); //lookup Opened for HR Profile to get work country
        grHRUser.addQuery('employee_number', grUser.opened_for.employee_number);
        grHRUser.query();

        if (grHRUser.next()) {
            usercountry = grHRUser.u_work_country.getDisplayValue();
        }

        //Get the user's country and find the relevant schedule record for user's country
        var scheduleQuery = "schedule.nameLIKE" + usercountry;
        var ScheduleGr = new GlideRecord("cmn_other_schedule");
        ScheduleGr.addEncodedQuery(scheduleQuery);
        ScheduleGr.query();
        if (ScheduleGr.next()) {
            current.schedule = ScheduleGr.schedule.toString();
        } else {
            current.schedule = "ec7cb3bedb67c0107565671cd3961982"; // UK Schedule
        }
    }

})(current, previous);

The primary issue we encountered was that the user's work country-related schedule was not shown in the "Show SLA Timeline" section. "8-5 weekdays excluding holidays" is the name of the inaccurate schedule that is being attached in the SLA Timeline.
 
Through the SLA Definitions, the SLA has been attached based on the HR Services.

The screenshots and script for the same are attached. Please check, and let me know if you have any problems.
 
Regards
Govinda Varma T