- 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 12:15 PM
Hi,
You need to include the additional fields in script include "ServiceManagementIncidentUtils".
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:20 PM
Thanks. Here's the portion in the Script include that references Create Incident From Case. How would I update this portion to include these 2 values?
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();
caseGr.incident = incSysId;
caseGr.update();
gs.addInfoMessage(gs.getMessage("Incident {0} created", incGr.number));
uiActionHandler.openGlideRecord(incGr);
uiActionHandler.setReturnURL(caseGr);
},

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:15 PM
Hi,
ServiceManagementIncidentUtils() is a script include with function createIncdientFromCase() can you check the function & try passing the required values once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:15 PM
So:
Case Incident
u_service --> cmdb_ci
assignment_group --> assignment_group