Create an IT incident from the HR plugin

zwimi
Kilo Contributor

Hi all,

I have a problem with an HRC. In the following my example:

An employee creates a request and the responsible HR worker delegates it to IT department, because he can not resolve the issue.
The HR worker therefore wants to open a ticket at the IT servicedesk.

For clarification:
The HR instance and the IT instance should be strictly seperated.

Here are my Questions:

1. How can the HR worker pass the HRC to IT department ?(create an INC)

2. Can the newly created ticket be configured, so only information, which is not confidential, is visible?

Hopefully someone can Help.

1 ACCEPTED SOLUTION

It would look something more like this - ensure you have the Client checkbox checked and the onclick field says "runClientCode()" (without quotes)



//Client-side 'onclick' function


function runClientCode(){


    if(confirm(confirm("Do you want to create an incident") == false){


          return false;   //Abort submission


    }


    //Call the UI Action and skip the 'onclick' function


    gsftSubmit(null, g_form.getFormElement(), '<button_action_name>'); //MUST call the 'Action name' set in this UI Action


}



//Code that runs without 'onclick'


//Ensure call to server-side function with no browser errors


if(typeof window == 'undefined')


    runBusRuleCode();



//Server-side function


function runBusRuleCode(){


        var inc = new GlideRecord('incident');


          inc.initialize();


          inc.short_description = 'Test description';


          inc.caller_id.first_name = 'John';


          inc.caller_id.last_name = 'Smith';


          inc.insert();


}


View solution in original post

20 REPLIES 20

Okay - looking into it a little deeper. Once I did that, I received the following error:



find_real_file.png



So I have a co-worker looking into that with me right now. Conflict with a BR or something I think..



-Rob


Found the issue nielsm



it was within the code, line 24. I had created the related field on the Incident Form, however never captured it within the actual code. Therefore the Action had no idea what to do it it and therefore just skipped right over. It now works as needed!!



Thanks for the additional help with this!



-Rob


Is it possible to select location and pass the selected location to Incident/Request. We have added the below code to 'hr_to_incident_request' UI page and the location is displayed but we are unable to map it respective incident/request upon selection.

 

<div id="selectActionBoxContainer">
<label for="my_choice">Choose a Destrict: </label>
<select name="my_destrict" id="my_destrict" >
<g2:evaluate>
var rec = new GlideRecord('cmn_location');
rec.addEncodedQuery('u_location_type=Facility/Site'); //change city to your field name
rec.query();
var recList = [];
while(rec.next()) {
des = rec.city.getDisplayValue(); //change city to your field name
recList.push(des);
}
var arrayUtil = new ArrayUtil();
recList = arrayUtil.unique(recList);
recList.sort();
</g2:evaluate>

 

find_real_file.png

Simran321
Tera Expert

Hi There,

The UI Action is currently also available for Lifecycle cases. Is it possible to hide the UI action from Lifecycle cases.

You can modify the Condition field on the UI Action to exclude the Lifecycle Event case table using a condition like the one below. This would be in addition to any other conditions already being used.

current.sys_class_name!="sn_hr_le_case"