What is the best method to configure transferring an HR Case to an Incident

EarlH
Tera Contributor

I have a requirement to create a method to transfer an HR Case to an Incident.  Is the best method to use a UI Policy from the HR Case Form?

3 REPLIES 3

Tanushree Maiti
Giga Patron

Hi @EarlH 

 

To convert a ServiceNow HR Case to an Incident , create a server-side UI Action on the HR Case table that initializes a new GlideRecord incident, maps relevant fields (like caller and description), inserts the record, and redirects the user.

 

Note: You must handle cross-scope privileges, as HR is a scoped application and Incident is in the Global scope. 

 

Sample code (Not tested)

 

  • Name: Create Incident
  • Table: HR Case
  • Client: Unchecked (Server-side)
  • Form Button: Checked
createIncident();

function createIncident() {
    var inc = new GlideRecord('incident');
    inc.initialize();
    
    // Map fields from HR Case to Incident  as per your requirement    inc.caller_id = current.subject_person;    inc.short_description = current.short_description;
    inc.description = current.description;
    inc.contact_type = 'employee_service_center'; // Or appropriate type
    
    var newInc = inc.insert();

     current.work_notes = "Incident " + inc.number + " created from this case.";
    current.update();

     gs.addInfoMessage("Incident " + inc.number + " created.");
    action.setRedirectURL(inc);
}

 

Refer: 

1. https://www.servicenow.com/community/servicenow-ai-platform-forum/from-a-hr-case-when-agent-uses-the...

 

2. https://www.servicenow.com/community/csm-forum/how-to-convert-case-to-incident/m-p/408014#:~:text=Ri...

 

3. KB0817494 How to map or copy field values from Case to Incident when using CSM Integration with Inci... 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Srikanth_9
Kilo Sage

Hi @EarlH,

 

No, using a UI Policy is not the best method. 

Instead, use a UI Action that triggers server-side logic (Script Include or Flow Designer) to transfer a HR Case to an Incident. 

 

Try with UI Action and Script Include, post here if you have any other questions related to this scenario. 

 

If the provided solution is useful/working, please Accept as Solution and hit the Helpful. 
 
Thanks & Regards,
Srikanth Akula.

 

yashkamde
Mega Sage

Hello @EarlH ,

 

Refer this little different but similar can be made for HR case as well :

https://www.servicenow.com/community/csm-forum/how-to-convert-case-to-incident/m-p/408014/page/2 

 

If my response helped mark as helpful and accept the solution.