HR Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 01:15 AM
Hi All,
I am trying to create a task in hr case when hr case is closed complete . Is it possible to create a hr task automatically to the hr case after the hr case is inactive and it is possible to create a hr task automatically when particular hr service and subcategory is selected .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:48 AM
@kali Here are my take on both of your questions.1
1. Scenario1: Is it possible to create a hr task automatically to the hr case after the hr case is inactive
Answer: Yes, this can be achieved via the following business rule on sn_hr_core_case table.
Here is the script.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var glideHRTask = new GlideRecord('sn_hr_core_task');
glideHRTask.initialize();
glideHRTask.setValue('parent',current.getValue('sys_id'));
glideHRTask.setValue('short_description','<short description for your hr task>');
glideHRTask.insert();
})(current, previous);
2. Scenario2:
It is possible to create a hr task automatically when particular hr service and subcategory is selected .
Answer: Yes, it is possible, create the business rule as follows.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var glideHRTask = new GlideRecord('sn_hr_core_task');
glideHRTask.initialize();
glideHRTask.setValue('parent',current.getValue('sys_id'));
glideHRTask.setValue('short_description','<short description for your hr task>');
glideHRTask.insert();
})(current, previous);
Hope this helps.