create hr case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2024 01:35 AM
Hi All,
I want to create child hr case when users click on the ui action on the parent case . Please let me know how to achieve it
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2024 01:44 AM
Hi @kali ,
Did you check for the OOTB Action to see if it satisfy your need...
having a active case opened in the record view, you will find that button at the related list "Child Cases":
(Add & New button)
After clicking on it you get an overlay with a list of other cases which can be selected to be moved as child cases for the parent case in the background:
If you need a button , then you need to create a UI Action, let me know if you need futher help....
āļø Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2024 02:54 AM
Hi @Sohail Khilji ,
When users click on the ui action system should automatically create hr cases the child case should auto fill opened for , subject person , assignment group , assigned to from the parent case to child case. Please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2024 02:59 AM
Hi @kali ,
Create a ui ACTION WITH BELOW CODE:
(function() {
var parentHRCaseID = g_form.getUniqueValue();
var parentHRCase = new GlideRecord('hr_case');
parentHRCase.get(parentHRCaseID);
if (!parentHRCase.isValid()) {
gs.addErrorMessage("Parent HR case not found.");
return;
}
var childCase = {
parent: parentHRCaseID,
opened_for: parentHRCase.opened_for.toString(),
subject_person: parentHRCase.subject_person.toString(),
assignment_group: parentHRCase.assignment_group.toString(),
assigned_to: parentHRCase.assigned_to.toString(),
short_description: "Child Case Short Description", // You can customize this
description: "Child Case Description" // You can customize this
// Add more fields as necessary
};
var childCaseGR = new GlideRecord('hr_case');
childCaseGR.initialize();
for (var field in childCase) {
if (childCase.hasOwnProperty(field)) {
childCaseGR.setValue(field, childCase[field]);
}
}
var childCaseID = childCaseGR.insert();
if (childCaseID) {
gs.addInfoMessage("Child HR case created successfully with ID: " + childCaseID);
} else {
gs.addErrorMessage("Failed to create child HR case");
}
})();
āļø Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....