I want to create HR cases without going to ESC portal

Community Alums
Not applicable

Hello,

I want to create HR cases without going to ESC portal and filling the form. Currently I have record producers for Onboarding and Offboarding. While developing some features I need to create HR cases frequently for testing the feature and it takes lot of time so I need a solution with i can save my time of HR case creation from ESC portal. I don't want to use API. Please if you have any suggestion which I can use please let me know it would be helpful. Could we use fix script or not, if yes then how?

Thank you in advance.

1 ACCEPTED SOLUTION

Sanjay191
Tera Sage

Hello @Community Alums 
You could create from native as well and also you can create through inbound email action and also you can create through HR profile and also you create through Bulk case Creation for the Onboarding and Offboarding.
Yes you can use the Fix script to create HR case please refer the below script and preform  required  changes accordingly

 var hrCase = new GlideRecord('sn_hr_core_case');
    hrCase.initialize();
   
    // Set fields for HR Onboarding case
    hrCase.short_description = 'New Hire Onboarding for ';
    hrCase.opened_for = '8d56406a0a0a0a6b004070b354aada28'; // sys_id of user
    hrCase.subject_person = '8d56406a0a0a0a6b004070b354aada28'; //  sys_id  of user
    hrCase.priority = 4;
   
    // Replace with your HR service Sys ID
        hrCase.hr_service = '330db1099f231200d9011977677fcf37';
   // }
   
    // Insert HR Case record
    var caseSysId = hrCase.insert();
    gs.info('HR Sys ID: ' + caseSysId);

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You

 

View solution in original post

3 REPLIES 3

James Schwab
Tera Guru

Hi sairajgad, 

Yes you could use a fix script or tie a script include to a UI action on your preferred record to repeatedly create new cases. Your code will need to look something like this:

//Replace incident with your table
var gr =new GlideRecord("incident");

//Begin new record creation
gr.newRecord();

//Populate your fields with your test data
gr.caller_id = 'a8f98bb0eb32010045e1a5115206fe3a';
gr.short_description = 'Put your data here';
gr.field3 = 'Put your data here';

//Insert the Record
gr.insert(); 



Sanjay191
Tera Sage

Hello @Community Alums 
You could create from native as well and also you can create through inbound email action and also you can create through HR profile and also you create through Bulk case Creation for the Onboarding and Offboarding.
Yes you can use the Fix script to create HR case please refer the below script and preform  required  changes accordingly

 var hrCase = new GlideRecord('sn_hr_core_case');
    hrCase.initialize();
   
    // Set fields for HR Onboarding case
    hrCase.short_description = 'New Hire Onboarding for ';
    hrCase.opened_for = '8d56406a0a0a0a6b004070b354aada28'; // sys_id of user
    hrCase.subject_person = '8d56406a0a0a0a6b004070b354aada28'; //  sys_id  of user
    hrCase.priority = 4;
   
    // Replace with your HR service Sys ID
        hrCase.hr_service = '330db1099f231200d9011977677fcf37';
   // }
   
    // Insert HR Case record
    var caseSysId = hrCase.insert();
    gs.info('HR Sys ID: ' + caseSysId);

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You

 

Community Alums
Not applicable

Hello @Sanjay191 
Thank you for your response. That really helped and I am able to implement.