- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 09:15 AM
I'm trying to create a HR case from a UI Action on the Call module.
I'm using the OOTB UI Action and modify it to create a HR Case instead of an Incident, the HR Case isn't created though for some reason.
I've tried doing it with a background script and get the same result
Trying to create a HR Case doesn't work, nothing is created but a number is consumed in the number serie.
var gr = new GlideRecord('hr_case');
gr.newRecord();
gr.short_description = 'TEST';
gr.insert();
If I try doing the same for Incident or Finance Request it works fine and record is created.
var gr = new GlideRecord('incident');
gr.newRecord();
gr.short_description = 'TEST';
gr.insert();
Any idea why a HR Case isn't created?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 11:43 AM
I just tried from Call module and it did create a HR case, but only if I wrap it in a function:
(function(current, previous, gs, action) {
var gr = new GlideRecord('hr_case');
gr.newRecord();
gr.short_description = 'TEST';
//gr.opened_for = gs.getUserID();
gr.opened_for = current.caller;
gr.insert();
})(current, previous, gs, action);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 09:40 AM
It did not create the case until I add:
gr.opened_for = gs.getUserID(); |
Try adding that line and see what happens:
(function(current, previous, gs, action) {
var gr = new GlideRecord('hr_case');
gr.newRecord();
gr.short_description = 'TEST';
gr.opened_for = gs.getUserID();
gr.insert();
})(current, previous, gs, action);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 10:11 AM
I get the same as before, no HR Case is created.
In my UI Action I had the following but without any luck
gr.opened_for = current.caller;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 10:25 AM
current.caller did not work but current.caller_id did work.
Did you clear all the HR cases that come out of the box? There are some with an updated date in the future, so my newly created cases are farther down in the list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 10:30 AM
It's a brand new instance with no demo data so I have 0 HR Cases there.
The field name is caller in the call module so it should not be caller_id in our case.
I tried with gs.getUserID() in a backgroudn script and it's not working either.