- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:07 PM
On our Case table, we have a UI Action called 'Create Incident'. I would like to update the script so it passes the values in the 'Service' field (u_service) and 'Assignment Group field (assignment_group) on the Case to the newly created Incident.
Here's the script currently. How would I add the additional values?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:38 PM
Use below code to update these custom fields.
createIncidentFromCase: function(caseGr, uiActionHandler) {
var incGr = new GlideRecord("incident");
var ep = new GlideScriptedExtensionPoint().getExtensions(ServiceManagementIntegrationConstants.CASE_INC_EXTENSION_POINT);
//If there is any other new extension instance other than the OOB one, concat them together
//The extension instance with higher order number would overwrite the one with lower order number
for(var i = 0; i < ep.length; i ++){
var point = ep[i];
point.copyFieldsFromCaseToIncident(incGr, caseGr);
}
var incSysId = incGr.insert();
var inc = new GlideRecord('incident');
inc.addQuery('sys_id',incSysId);
inc.query();
while(inc.next()){
inc.cmdb_ci = current.u_service;
inc.assignment_group = current.assignment_group;
inc.update();
}
caseGr.incident = incSysId;
caseGr.update();
gs.addInfoMessage(gs.getMessage("Incident {0} created", incGr.number));
uiActionHandler.openGlideRecord(incGr);
uiActionHandler.setReturnURL(caseGr);
},
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 05:18 PM
OK. That didn't work. If I use the new code above, do I need to make any changes to any of my fields? Or just update the script include with this code?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 05:29 PM
just update script include with latest code.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 05:45 PM
I think what I might be able to do, is change the Service field on the Case form to a reference field. Then, add a reference qual condition to narrow the search results to the 20 I created. Then, they will only see these 20 choices when searching.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 08:37 PM
I was able to change the Service field on the Case to a reference field, and have it reference the cmdb_ci table. I added a condition to only show choices that I created. I created an Incident from the Case, and the Configuration Item and Assignment Group fields were populated with the values from the Case.