Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

create hr case

kali
Tera Contributor

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

3 REPLIES 3

Sohail Khilji
Kilo Patron

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)

SohailKhilji_0-1711960850188.png

 

 

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:

SohailKhilji_1-1711960850190.png

 

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....

LinkedIn - Lets Connect

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.

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....

LinkedIn - Lets Connect