Automatic HR case assignment to Group

abirakundu23
Mega Sage

Hi All / @Sandeep Rajput ,

We have existing use case where HR case created automatically by schedule job based on the Day -10 logic which is based on the current date to Hire date in HR profile.  let's hire date is 19th April in user profile from current date but case will be created today & will be assigned to "XY" grp by using Assignment rule concept. New use case is case automatically assigned to "YZ" group from "XY" group for day - 5 logic i.e  15th April. How can we achieve this? From where we can change logic.

 

Existing Code for case creation for Day -10 logic:

var profile = new GlideRecord('sn_hr_core_profile');
while (profile.next()) {
   
    var hire = new GlideDateTime(profile.hire_date);
    var currentdate = new GlideDateTime();
    var gdt2 = new GlideDateTime(currentdate.getDisplayValue());
    diff = GlideDateTime.subtract(gdt2, hire);
    var res = diff.getDisplayValue().toString();
    var days = res.substring(0, 2);
    
   
if (days == "10"){
            var case = new GlideRecord("sn_hr_core_case");
            case.initialize();
           
            case.state = '10';
           
            case.priority = '4';
            case.insert();
            
        }
    }

 

1 REPLY 1

abirakundu23
Mega Sage

HI @Ankur Bawiskar / @Anurag Tripathi / @Murthy Ch ,

 

Could you suggest me to implement above scenario?